fix for /tinode/chat/issues/861

This commit is contained in:
or-else
2023-05-17 18:31:26 -07:00
parent c5c55fd9fd
commit baf211ff82
52 changed files with 175 additions and 62 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "Erfolgreich bestätigt",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "Passwort erfolgreich zurückgesetzt",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "Confirmed successfully",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "Password reset successfully",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "Confirmado con éxito",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "Restablecimiento de contraseña con éxito",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+5 -1
View File
@@ -209,7 +209,7 @@
},
"cred_confirmed_successfully": {
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated."
"description": "Notification message that the credential was successfully validated."
},
"credential_email_prompt": {
"defaultMessage": "Your registration email",
@@ -704,6 +704,10 @@
"defaultMessage": "A text message with security code has been sent.",
"description": "Notification that the SMS with password reset instructions has been sent"
},
"password_reset_success": {
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset."
},
"password_unchanged_prompt": {
"defaultMessage": "Unchanged",
"description": "Message in editor while password is unchanged"
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "Confirmé avec succès",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "Mot de passe réinitialisé avec succès",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "성공적으로 확인됨",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "비밀번호 재설정 성공",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "Confirmat cu succes",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "Resetarea parolei cu succes",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "Подтверждено успешно",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "Пароль успешно изменен",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "確認成功",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "密碼重置成功",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+8 -1
View File
@@ -1420,7 +1420,7 @@
"cred_confirmed_successfully": {
"translation": "确认成功",
"defaultMessage": "Confirmed successfully",
"description": "Message explaining that the credential was successfully validated.",
"description": "Notification message that the credential was successfully validated.",
"missing": false,
"obsolete": false
},
@@ -1633,5 +1633,12 @@
"description": "Error message when audio is not available",
"missing": false,
"obsolete": false
},
"password_reset_success": {
"translation": "密码重置成功",
"defaultMessage": "Password reset successfully",
"description": "Notification message that the password was successfully reset.",
"missing": false,
"obsolete": false
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ export default class HashNavigation {
// Parse hash as in http://www.example.com/path#hash as if it were
// path and arguments.
static parseUrlHash(hash) {
// Split path from args, path -> parts[0], args->path[1]
// Split 'path/?args' into 'path/' and 'args', path -> parts[0], args->path[1].
const parts = hash.split('?', 2);
const params = {};
let path = [];
+20 -4
View File
@@ -48,7 +48,23 @@ class PasswordResetView extends React.PureComponent {
componentDidMount() {
const parsed = HashNavigation.parseUrlHash(window.location.hash);
this.setState({token: parsed.params.token, scheme: parsed.params.scheme});
const newState = {
token: parsed.params.token,
scheme: parsed.params.scheme,
code: parsed.params.code || ''
}
this.savedCred = parsed.params.cred;
if (this.props.reqCredMethod && parsed.params.cred) {
newState[this.props.reqCredMethod] = this.savedCred;
}
this.setState(newState);
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.reqCredMethod != this.props.reqCredMethod && this.props.reqCredMethod) {
this.setState({[this.props.reqCredMethod]: this.savedCred || ''});
}
}
handleSubmit(e) {
@@ -62,7 +78,7 @@ class PasswordResetView extends React.PureComponent {
} else if (this.state.code && this.props.reqCredMethod) {
// Reset using security code.
// The secret is structured as <code>:<cred_method>:<cred_value>, "123456:email:alice@example.com".
const cred = this.state.email.trim() || this.state.tel.trim();
const cred = this.props.reqCredMethod == 'email' ? this.state.email.trim() : this.state.tel.trim();
this.props.onReset(this.state.password.trim(), {
scheme: 'code',
secret: btoa(`${this.state.code}:${this.props.reqCredMethod}:${cred}`)
@@ -102,7 +118,7 @@ class PasswordResetView extends React.PureComponent {
}
render() {
const showCredentialInput = !(this.state.token && this.state.scheme);
const showCredentialInput = !((this.state.token || (this.state.code && this.props.reqCredMethod)) && this.state.scheme);
const showPasswordInput = !showCredentialInput || this.state.haveCode || this.state.sent;
const passwordInput = (<>
@@ -193,7 +209,7 @@ class PasswordResetView extends React.PureComponent {
{this.state.haveCode || this.state.sent ? codeInput : null}
{showPasswordInput ? passwordInput : null}
<div className="dialog-buttons">
{this.state.haveCode || this.state.sent || this.state.token ? null :
{this.state.haveCode || this.state.sent || this.state.token || this.state.code ? null :
<a href="#" onClick={this.handleShowCodeField} style={{marginRight: 'auto'}}>
<FormattedMessage id="password_i_have_code" defaultMessage="I have code"
description="Call to open field to enter password reset code" />
+10 -3
View File
@@ -83,7 +83,12 @@ const messages = defineMessages({
cred_confirmed_successfully: {
id: 'cred_confirmed_successfully',
defaultMessage: 'Confirmed successfully',
description: 'Message explaining that the credential was successfully validated.'
description: 'Notification message that the credential was successfully validated.'
},
password_reset_success: {
id: 'password_reset_success',
defaultMessage: 'Password reset successfully',
description: 'Notification message that the password was successfully reset.'
}
});
@@ -1733,9 +1738,11 @@ class TinodeWeb extends React.Component {
} else {
this.tinode.connect()
.then(_ => this.tinode.updateAccountBasic(null, null, newPassword, {scheme: tempAuth.scheme, secret: secret}))
.then(_ => HashNavigation.navigateTo(''))
.then(_ => {
this.handleError(this.props.intl.formatMessage(messages.password_reset_success), 'info');
HashNavigation.navigateTo('');
})
.catch(err => {
// Socket error
this.handleError(err.message, 'err');
});
}