diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-07-25 09:16:52 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-07-25 09:16:52 -0300 |
| commit | 843f74f5c4be4ff57f6eb9b69949f6147509901b (patch) | |
| tree | a9224d3ce3214cfd2f7b7f9cafa5adb72f3e5f49 | |
| parent | 97d4e00d1a83462c46ef7347efffc7b1c2109d62 (diff) | |
| parent | 58909f19bb5480377e4130ef69c3affcc7cda118 (diff) | |
| download | mullvadvpn-843f74f5c4be4ff57f6eb9b69949f6147509901b.tar.xz mullvadvpn-843f74f5c4be4ff57f6eb9b69949f6147509901b.zip | |
Merge branch 'ignore-accounts-with-less-than-ten-digits'
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | app/components/Login.js | 8 | ||||
| -rw-r--r-- | test/components/Login.spec.js | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fda725ddfe..04db8b3a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Line wrap the file at 100 chars. Th - Lower per log size limit in the problem report to 128 kiB. - Relay list is now updated periodically automatically, not only when the daemon starts. - Format the expiry date and time using the system locale. +- Account tokens are now required to have at least ten digits. #### Windows - Rename tunnel interface to "Mullvad". diff --git a/app/components/Login.js b/app/components/Login.js index e1a11d2071..d902bba1bc 100644 --- a/app/components/Login.js +++ b/app/components/Login.js @@ -31,6 +31,8 @@ type State = { isActive: boolean, }; +const MIN_ACCOUNT_TOKEN_LENGTH = 10; + export default class Login extends Component<Props, State> { state = { isActive: true, @@ -182,7 +184,7 @@ export default class Login extends Component<Props, State> { _onLogin = () => { const accountToken = this.props.accountToken; - if (accountToken && accountToken.length > 0) { + if (accountToken && accountToken.length >= MIN_ACCOUNT_TOKEN_LENGTH) { this.props.login(accountToken); } }; @@ -278,7 +280,7 @@ export default class Login extends Component<Props, State> { const { accountToken, loginState } = this.props; const classes = [styles.input_arrow]; - if (accountToken && accountToken.length > 0) { + if (accountToken && accountToken.length >= MIN_ACCOUNT_TOKEN_LENGTH) { classes.push(styles.input_arrow__active); } @@ -291,7 +293,7 @@ export default class Login extends Component<Props, State> { _shouldActivateLoginButton() { const { accountToken } = this.props; - return accountToken && accountToken.length > 0; + return accountToken && accountToken.length >= MIN_ACCOUNT_TOKEN_LENGTH; } _shouldEnableAccountInput() { diff --git a/test/components/Login.spec.js b/test/components/Login.spec.js index 0db789c55d..2767d37068 100644 --- a/test/components/Login.spec.js +++ b/test/components/Login.spec.js @@ -48,10 +48,10 @@ describe('components/Login', () => { it('logs in with the entered account number when clicking the login icon', (done) => { const component = shallow(<Login {...defaultProps} />); component.setProps({ - accountToken: '12345', + accountToken: '1234567890', login: (accountToken) => { try { - expect(accountToken).to.equal('12345'); + expect(accountToken).to.equal('1234567890'); done(); } catch (e) { done(e); |
