From bd0e676b4691b0f98de7450d47cdbf1398db48b3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 6 Jun 2019 09:16:28 +0100 Subject: [PATCH 1/3] Switch ugly password boxes to Field or styled input Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../auth/_InteractiveAuthEntryComponents.scss | 10 ++++- .../dialogs/_DeactivateAccountDialog.scss | 7 ++++ .../auth/InteractiveAuthEntryComponents.js | 37 ++++++++----------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/res/css/views/auth/_InteractiveAuthEntryComponents.scss b/res/css/views/auth/_InteractiveAuthEntryComponents.scss index e2ea7d86fb..8c4f800d19 100644 --- a/res/css/views/auth/_InteractiveAuthEntryComponents.scss +++ b/res/css/views/auth/_InteractiveAuthEntryComponents.scss @@ -55,4 +55,12 @@ limitations under the License. .mx_InteractiveAuthEntryComponents_termsPolicy { display: block; -} \ No newline at end of file +} + +.mx_InteractiveAuthEntryComponents_passwordSection { + width: 300px; +} + +.mx_InteractiveAuthEntryComponents_passwordSection input { + width: 100%; +} diff --git a/res/css/views/dialogs/_DeactivateAccountDialog.scss b/res/css/views/dialogs/_DeactivateAccountDialog.scss index dc76da5b15..9230e6b61c 100644 --- a/res/css/views/dialogs/_DeactivateAccountDialog.scss +++ b/res/css/views/dialogs/_DeactivateAccountDialog.scss @@ -21,3 +21,10 @@ limitations under the License. .mx_DeactivateAccountDialog .mx_DeactivateAccountDialog_input_section { margin-top: 60px; } + +.mx_DeactivateAccountDialog .mx_DeactivateAccountDialog_input_section input { + width: 300px; + border: 1px solid $accent-color; + border-radius: 5px; + padding: 10px; +} diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index b3687db2bd..0e866ad586 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -81,16 +81,10 @@ export const PasswordAuthEntry = React.createClass({ getInitialState: function() { return { - passwordValid: false, + password: "", }; }, - focus: function() { - if (this.refs.passwordField) { - this.refs.passwordField.focus(); - } - }, - _onSubmit: function(e) { e.preventDefault(); if (this.props.busy) return; @@ -98,23 +92,21 @@ export const PasswordAuthEntry = React.createClass({ this.props.submitAuthDict({ type: PasswordAuthEntry.LOGIN_TYPE, user: this.props.matrixClient.credentials.userId, - password: this.refs.passwordField.value, + password: this.state.password, }); }, _onPasswordFieldChange: function(ev) { // enable the submit button iff the password is non-empty this.setState({ - passwordValid: Boolean(this.refs.passwordField.value), + password: ev.target.value, }); }, render: function() { - let passwordBoxClass = null; - - if (this.props.errorText) { - passwordBoxClass = 'error'; - } + const passwordBoxClass = classnames({ + "error": this.props.errorText, + }); let submitButtonOrSpinner; if (this.props.busy) { @@ -124,7 +116,7 @@ export const PasswordAuthEntry = React.createClass({ submitButtonOrSpinner = ( ); } @@ -138,17 +130,20 @@ export const PasswordAuthEntry = React.createClass({ ); } + const Field = sdk.getComponent('elements.Field'); + return (
{ _t("To continue, please enter your password.") }
-