mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-12 07:30:46 +02:00
Merge pull request #12342 from overleaf/jk-password-ux-please-use-another-password
[web] Password UX: 'Please use another password' GitOrigin-RevId: ca9b26cbcf2dabb27c716da314764ee40ffc83dd
This commit is contained in:
@@ -61,6 +61,9 @@ describe('UserController', function () {
|
||||
authenticate: sinon.stub(),
|
||||
setUserPassword: sinon.stub(),
|
||||
},
|
||||
getMessageForInvalidPasswordError: sinon
|
||||
.stub()
|
||||
.returns({ type: 'error', key: 'some-key' }),
|
||||
}
|
||||
this.UserUpdater = {
|
||||
changeEmailAddress: sinon.stub(),
|
||||
@@ -771,18 +774,21 @@ describe('UserController', function () {
|
||||
// .returns({ message: 'validation-error' })
|
||||
const err = new Error('bad')
|
||||
err.name = 'InvalidPasswordError'
|
||||
const message = {
|
||||
type: 'error',
|
||||
key: 'some-message-key',
|
||||
}
|
||||
this.AuthenticationManager.getMessageForInvalidPasswordError.returns(
|
||||
message
|
||||
)
|
||||
this.AuthenticationManager.promises.setUserPassword.rejects(err)
|
||||
this.AuthenticationManager.promises.authenticate.resolves({})
|
||||
this.req.body = {
|
||||
newPassword1: 'newpass',
|
||||
newPassword2: 'newpass',
|
||||
}
|
||||
this.HttpErrorHandler.badRequest.callsFake(() => {
|
||||
expect(this.HttpErrorHandler.badRequest).to.have.been.calledWith(
|
||||
this.req,
|
||||
this.res,
|
||||
err.message
|
||||
)
|
||||
this.res.json.callsFake(result => {
|
||||
expect(result.message).to.deep.equal(message)
|
||||
this.AuthenticationManager.promises.setUserPassword.callCount.should.equal(
|
||||
1
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user