summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2019-01-17 14:40:22 +0100
committerAndrej Mihajlov <and@mullvad.net>2019-01-17 14:40:22 +0100
commit92219d2e41d4687fc5ad154cee2932991b5a01d1 (patch)
tree59e46f7a79b701b744e9e684c56e65e09ba301ab
parent0124c7e85e305299f7ff7940280cbfd4353a0f48 (diff)
parent043ed2cbd5a23f2aadc35c91f97632c570b10fee (diff)
downloadmullvadvpn-92219d2e41d4687fc5ad154cee2932991b5a01d1.tar.xz
mullvadvpn-92219d2e41d4687fc5ad154cee2932991b5a01d1.zip
Merge branch 'login-successful'
-rw-r--r--gui/packages/desktop/src/renderer/components/Login.js17
-rw-r--r--gui/packages/desktop/test/components/Login.spec.js4
2 files changed, 10 insertions, 11 deletions
diff --git a/gui/packages/desktop/src/renderer/components/Login.js b/gui/packages/desktop/src/renderer/components/Login.js
index e0491141a7..f1ce7542c7 100644
--- a/gui/packages/desktop/src/renderer/components/Login.js
+++ b/gui/packages/desktop/src/renderer/components/Login.js
@@ -101,7 +101,7 @@ export default class Login extends Component<Props, State> {
{this._getStatusIcon()}
<Text style={styles.title}>{this._formTitle()}</Text>
- {this._shouldShowLoginForm() && <View>{this._createLoginForm()}</View>}
+ {this._createLoginForm()}
</View>
<Animated.View
@@ -209,7 +209,7 @@ export default class Login extends Component<Props, State> {
case 'failed':
return 'Login failed';
case 'ok':
- return 'Login successful';
+ return 'Logged in';
default:
return 'Login';
}
@@ -222,6 +222,8 @@ export default class Login extends Component<Props, State> {
return (loginError && loginError.message) || 'Unknown error';
case 'logging in':
return 'Checking account number';
+ case 'ok':
+ return 'Correct account number';
default:
return 'Enter your account number';
}
@@ -259,6 +261,7 @@ export default class Login extends Component<Props, State> {
switch (this.props.loginState) {
case 'logging in':
+ case 'ok':
classes.push(styles.account_input_group__inactive);
break;
case 'failed':
@@ -272,7 +275,7 @@ export default class Login extends Component<Props, State> {
_accountInputButtonStyles(): Array<Object> {
const classes = [styles.input_button];
- if (this.props.loginState === 'logging in') {
+ if (this.props.loginState === 'logging in' || this.props.loginState === 'ok') {
classes.push(styles.input_button__invisible);
}
@@ -298,8 +301,8 @@ export default class Login extends Component<Props, State> {
}
_shouldEnableAccountInput() {
- // enable account input always except when "logging in"
- return this.props.loginState !== 'logging in';
+ // enable account input always except when "logging in" or "logged in"
+ return this.props.loginState !== 'logging in' && this.props.loginState !== 'ok';
}
_shouldShowAccountHistory() {
@@ -310,10 +313,6 @@ export default class Login extends Component<Props, State> {
);
}
- _shouldShowLoginForm() {
- return this.props.loginState !== 'ok';
- }
-
_shouldShowFooter() {
return (
(this.props.loginState === 'none' || this.props.loginState === 'failed') &&
diff --git a/gui/packages/desktop/test/components/Login.spec.js b/gui/packages/desktop/test/components/Login.spec.js
index 79ccc7850f..b2ab36fdc2 100644
--- a/gui/packages/desktop/test/components/Login.spec.js
+++ b/gui/packages/desktop/test/components/Login.spec.js
@@ -29,7 +29,7 @@ describe('components/Login', () => {
expect(getComponent(component, 'AccountInput').length).to.be.above(0);
});
- it('does not show the footer nor account input when logged in', () => {
+ it('does not show the footer but shows the account input when logged in', () => {
const component = shallow(
<Login
{...{
@@ -42,7 +42,7 @@ describe('components/Login', () => {
const invisibleFooters = getComponent(component, 'footerVisibility false');
expect(visibleFooters.length).to.equal(0);
expect(invisibleFooters.length).to.equal(1);
- expect(getComponent(component, 'AccountInput').length).to.equal(0);
+ expect(getComponent(component, 'AccountInput').length).to.equal(1);
});
it('logs in with the entered account number when clicking the login icon', (done) => {