Skip to content

Commit

Permalink
onboarding: disallow primary as wallet name (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithvikvibhu committed Feb 6, 2022
1 parent fe412e1 commit 9f6054d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/pages/AcountLogin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { withRouter } from 'react-router';
import walletClient from "../../utils/walletClient";
import {I18nContext} from "../../utils/i18n";

@withRouter
@connect(
(state) => ({
wallets: state.wallet.wallets,
Expand All @@ -21,7 +22,6 @@ import {I18nContext} from "../../utils/i18n";
fetchWallet: () => dispatch(walletActions.fetchWallet()),
}),
)
@withRouter
export default class AccountLogin extends Component {
static propTypes = {
unlockWallet: PropTypes.func.isRequired,
Expand Down
6 changes: 4 additions & 2 deletions app/pages/Onboarding/SetName/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class CreatePassword extends Component {

isValidName = () => {
const {errorMessage, name} = this.state;
return !errorMessage && name.match(/^[a-z0-9]+$/);
return !errorMessage && name.match(/^[a-z0-9]+$/) && name !== 'primary';
};

onChange = (name) => async (e) => {
Expand All @@ -71,7 +71,9 @@ export default class CreatePassword extends Component {

let errorMessage = '';

if (wallets.includes(inputValue)) {
if (inputValue === 'primary') {
errorMessage = t('obSetNameCannotUseError', inputValue);
} else if (wallets.includes(inputValue)) {
errorMessage = t('obSetNameAlreadyExistError', inputValue);
}

Expand Down

0 comments on commit 9f6054d

Please sign in to comment.