Merge pull request #11078 from ChesterSng/11602-display-message-when-social-auth-acc-uses-password

Fixes #11062 Display information message when social authentication account uses password to login
This commit is contained in:
Matteo Pagliazzi
2019-03-23 18:36:12 +01:00
committed by GitHub
5 changed files with 47 additions and 1 deletions
@@ -110,4 +110,22 @@ describe('POST /user/auth/local/login', () => {
let isValidPassword = await bcryptCompare(textPassword, user.auth.local.hashed_password);
expect(isValidPassword).to.equal(true);
});
it('user uses social authentication and has no password', async () => {
await user.unset({
'auth.local.hashed_password': 1,
});
await user.sync();
expect(user.auth.local.hashed_password).to.be.undefined;
await expect(api.post(endpoint, {
username: user.auth.local.username,
password: 'any-password',
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidLoginCredentialsLong'),
});
});
});