mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Fixed bug with password form
This commit is contained in:
@@ -371,6 +371,14 @@ class ErrParentDoesNotVisible extends TalkError {
|
||||
}
|
||||
}
|
||||
|
||||
class ErrPasswordIncorrect extends TalkError {
|
||||
constructor() {
|
||||
super('Your current password was entered incorrectly', {
|
||||
translation_key: 'PASSWORD_INCORRECT',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
TalkError,
|
||||
ErrAlreadyExists,
|
||||
@@ -395,6 +403,7 @@ module.exports = {
|
||||
ErrNotFound,
|
||||
ErrNotVerified,
|
||||
ErrParentDoesNotVisible,
|
||||
ErrPasswordIncorrect,
|
||||
ErrPasswordResetToken,
|
||||
ErrPasswordTooShort,
|
||||
ErrPermissionUpdateUsername,
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
const { ErrNotFound, ErrNotAuthorized } = require('../../errors');
|
||||
const {
|
||||
ErrNotFound,
|
||||
ErrNotAuthorized,
|
||||
ErrPasswordIncorrect,
|
||||
} = require('../../errors');
|
||||
const Users = require('../../services/users');
|
||||
const migrationHelpers = require('../../services/migration/helpers');
|
||||
const {
|
||||
@@ -170,7 +174,7 @@ const changeUserPassword = async (ctx, oldPassword, newPassword) => {
|
||||
// Verify the old password.
|
||||
const validPassword = await user.verifyPassword(oldPassword);
|
||||
if (!validPassword) {
|
||||
throw new ErrNotAuthorized();
|
||||
throw new ErrPasswordIncorrect();
|
||||
}
|
||||
|
||||
// Change the users password now.
|
||||
|
||||
@@ -225,6 +225,7 @@ en:
|
||||
embedlink:
|
||||
copy: "Copy to Clipboard"
|
||||
error:
|
||||
PASSWORD_INCORRECT: "Your current password was entered incorrectly"
|
||||
COMMENT_PARENT_NOT_VISIBLE: "The comment that you're replying to has been removed or doesn't exist."
|
||||
EMAIL_VERIFICATION_TOKEN_INVALID: "Email verification token is invalid."
|
||||
EMAIL_ALREADY_VERIFIED: "Email address already verified."
|
||||
|
||||
@@ -127,12 +127,11 @@ class ChangePassword extends React.Component {
|
||||
'success',
|
||||
t('talk-plugin-local-auth.change_password.changed_password_msg')
|
||||
);
|
||||
this.clearForm();
|
||||
this.disableEditing();
|
||||
} catch (err) {
|
||||
this.props.notify('error', getErrorMessages(err));
|
||||
}
|
||||
|
||||
this.clearForm();
|
||||
this.disableEditing();
|
||||
};
|
||||
|
||||
onForgotPassword = async () => {
|
||||
|
||||
Reference in New Issue
Block a user