From 91c83e6ab4ddc37da7b005e3f1383f945126f391 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Wed, 30 Mar 2016 10:39:13 -0400 Subject: Update email/password settings text depending on sign-in method --- .../user_settings/user_settings_security.jsx | 251 +++++++++++++-------- 1 file changed, 151 insertions(+), 100 deletions(-) (limited to 'webapp/components/user_settings/user_settings_security.jsx') diff --git a/webapp/components/user_settings/user_settings_security.jsx b/webapp/components/user_settings/user_settings_security.jsx index b34fa8582..f24beb6b3 100644 --- a/webapp/components/user_settings/user_settings_security.jsx +++ b/webapp/components/user_settings/user_settings_security.jsx @@ -30,14 +30,6 @@ const holders = defineMessages({ id: 'user.settings.security.passwordMatchError', defaultMessage: 'The new passwords you entered do not match' }, - password: { - id: 'user.settings.security.password', - defaultMessage: 'Password' - }, - lastUpdated: { - id: 'user.settings.security.lastUpdated', - defaultMessage: 'Last updated {date} at {time}' - }, method: { id: 'user.settings.security.method', defaultMessage: 'Sign-in Method' @@ -131,74 +123,106 @@ class SecurityTab extends React.Component { } createPasswordSection() { let updateSectionStatus; - const {formatMessage} = this.props.intl; - if (this.props.activeSection === 'password' && this.props.user.auth_service === '') { + if (this.props.activeSection === 'password') { const inputs = []; + let submit; - inputs.push( -
- -
- + if (this.props.user.auth_service === '') { + submit = this.submitPassword; + + inputs.push( +
+ +
+ +
-
- ); - inputs.push( -
- -
- + ); + inputs.push( +
+ +
+ +
-
- ); - inputs.push( -
- -
- + ); + inputs.push( +
+ +
+ +
-
- ); + ); + } else if (this.props.user.auth_service === Constants.GITLAB_SERVICE) { + inputs.push( +
+
+ +
+
+ ); + } else if (this.props.user.auth_service === Constants.LDAP_SERVICE) { + inputs.push( +
+
+ +
+
+ ); + } updateSectionStatus = function resetSection(e) { this.props.updateSection(''); @@ -209,9 +233,14 @@ class SecurityTab extends React.Component { return ( + } inputs={inputs} - submit={this.submitPassword} + submit={submit} server_error={this.state.serverError} client_error={this.state.passwordError} updateSection={updateSectionStatus} @@ -219,34 +248,51 @@ class SecurityTab extends React.Component { ); } - var describe; - var d = new Date(this.props.user.last_password_update); + let describe; - const hours12 = !Utils.isMilitaryTime(); - describe = ( - - ), - time: ( - - ) - }} - /> - ); + if (this.props.user.auth_service === '') { + const d = new Date(this.props.user.last_password_update); + const hours12 = !Utils.isMilitaryTime(); + + describe = ( + + ), + time: ( + + ) + }} + /> + ); + } else if (this.props.user.auth_service === Constants.GITLAB_SERVICE) { + describe = ( + + ); + } else if (this.props.user.auth_service === Constants.LDAP_SERVICE) { + describe = ( + + ); + } updateSectionStatus = function updateSection() { this.props.updateSection('password'); @@ -254,7 +300,12 @@ class SecurityTab extends React.Component { return ( + } describe={describe} updateSection={updateSectionStatus} /> -- cgit v1.2.3-1-g7c22