+ {this._flagImgForIso2(country.iso2)}
+ {country.name}
+
;
+ });
+
+ // default value here too, otherwise we need to handle null / undefined
+ // values between mounting and the initial value propgating
+ const value = this.props.value || COUNTRIES[0].iso2;
+
+ return
+
A text message has been sent to +{this._msisdn}
+
Please enter the code it contains:
+
+
+
+ {this.state.errorText}
+
+
+
+ );
+ }
+ },
+});
+
export const FallbackAuthEntry = React.createClass({
displayName: 'FallbackAuthEntry',
@@ -313,6 +446,7 @@ const AuthEntryComponents = [
PasswordAuthEntry,
RecaptchaAuthEntry,
EmailIdentityAuthEntry,
+ MsisdnAuthEntry,
];
export function getEntryComponentForLoginType(loginType) {
diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js
index 6f6081858b..61cb3da652 100644
--- a/src/components/views/login/PasswordLogin.js
+++ b/src/components/views/login/PasswordLogin.js
@@ -1,5 +1,6 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
+Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@ limitations under the License.
import React from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
+import sdk from '../../../index';
import {field_input_incorrect} from '../../../UiEffects';
@@ -28,8 +30,12 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
onSubmit: React.PropTypes.func.isRequired, // fn(username, password)
onForgotPasswordClick: React.PropTypes.func, // fn()
initialUsername: React.PropTypes.string,
+ initialPhoneCountry: React.PropTypes.string,
+ initialPhoneNumber: React.PropTypes.string,
initialPassword: React.PropTypes.string,
onUsernameChanged: React.PropTypes.func,
+ onPhoneCountryChanged: React.PropTypes.func,
+ onPhoneNumberChanged: React.PropTypes.func,
onPasswordChanged: React.PropTypes.func,
loginIncorrect: React.PropTypes.bool,
},
@@ -38,7 +44,11 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
return {
onUsernameChanged: function() {},
onPasswordChanged: function() {},
+ onPhoneCountryChanged: function() {},
+ onPhoneNumberChanged: function() {},
initialUsername: "",
+ initialPhoneCountry: "",
+ initialPhoneNumber: "",
initialPassword: "",
loginIncorrect: false,
};
@@ -48,6 +58,8 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
return {
username: this.props.initialUsername,
password: this.props.initialPassword,
+ phoneCountry: this.props.initialPhoneCountry,
+ phoneNumber: this.props.initialPhoneNumber,
};
},
@@ -63,7 +75,12 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
onSubmitForm: function(ev) {
ev.preventDefault();
- this.props.onSubmit(this.state.username, this.state.password);
+ this.props.onSubmit(
+ this.state.username,
+ this.state.phoneCountry,
+ this.state.phoneNumber,
+ this.state.password,
+ );
},
onUsernameChanged: function(ev) {
@@ -71,6 +88,16 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
this.props.onUsernameChanged(ev.target.value);
},
+ onPhoneCountryChanged: function(country) {
+ this.setState({phoneCountry: country});
+ this.props.onPhoneCountryChanged(country);
+ },
+
+ onPhoneNumberChanged: function(ev) {
+ this.setState({phoneNumber: ev.target.value});
+ this.props.onPhoneNumberChanged(ev.target.value);
+ },
+
onPasswordChanged: function(ev) {
this.setState({password: ev.target.value});
this.props.onPasswordChanged(ev.target.value);
@@ -92,13 +119,28 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
error: this.props.loginIncorrect,
});
+ const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
return (