Skip to content

Commit

Permalink
Adjusting to view field of email to app admin when create new organiz… (
Browse files Browse the repository at this point in the history
#127)

* Adjusting to view field of email to app admin when create new organization (#125)

* Adding validation for user response when ask if run in current directory (#124)

Co-authored-by: Lucas Bruno <69604366+lucasbrunozup@users.noreply.github.com>
  • Loading branch information
wiliansilvazup and lucasbrunozup authored Nov 11, 2020
1 parent e061705 commit ff9e20e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 13 additions & 3 deletions horusec-cli/cmd/horusec/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,19 @@ func (s *Start) askIfRunInDirectorySelected(shouldAsk bool) error {
if err != nil {
return err
}
if !strings.EqualFold(response, "y") {
return errors.New("{HORUSEC_CLI} Operation was canceled by user")
}
return s.validateReplyOfAsk(response)
}
return nil
}

func (s *Start) validateReplyOfAsk(response string) error {
if !strings.EqualFold(response, "y") && !strings.EqualFold(response, "n") {
logger.LogErrorWithLevel("Your response was: '"+response+"' Please type Y or N",
errors.New("reply invalid"), logger.ErrorLevel)
return s.askIfRunInDirectorySelected(true)
}
if strings.EqualFold(response, "n") {
return errors.New("{HORUSEC_CLI} Operation was canceled by user")
}
return nil
}
Expand Down
8 changes: 3 additions & 5 deletions horusec-manager/src/pages/Internal/Company/Add/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ import { useHistory } from 'react-router-dom';
import { CompanyContext } from 'contexts/Company';
import { getCurrentConfig } from 'helpers/localStorage/horusecConfig';
import { authTypes } from 'helpers/enums/authTypes';
import {
isApplicationAdmin,
getCurrentUser,
} from 'helpers/localStorage/currentUser';
import { getCurrentUser } from 'helpers/localStorage/currentUser';

function AddCompany() {
const { t } = useTranslation();
const history = useHistory();
const currentUser = getCurrentUser();
const { applicationAdminEnable } = getCurrentConfig();

const [companyName, setCompanyName] = useState<Field>({
isValid: false,
Expand Down Expand Up @@ -84,7 +82,7 @@ function AddCompany() {
invalidMessage={t('COMPANY_SCREEN.INVALID_ORGANIZATION_NAME')}
/>

{isApplicationAdmin() ? (
{applicationAdminEnable ? (
<Styled.Wrapper>
<Styled.Label>{t('COMPANY_SCREEN.ADMIN_EMAIL')}</Styled.Label>

Expand Down

0 comments on commit ff9e20e

Please sign in to comment.