-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(API/login): permissive email handling
Allow case insensitive email when there's no other candidate. closes #6570
- Loading branch information
1 parent
697c039
commit 4134f25
Showing
3 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ describe('Test oauth', function () { | |
}) | ||
|
||
await setAccessTokensToServers([ server ]) | ||
await server.users.create({ username: 'user1', email: '[email protected]' }) | ||
await server.users.create({ username: 'user2', email: '[email protected]', password: 'AdvancedPassword' }) | ||
|
||
sqlCommand = new SQLCommand(server) | ||
}) | ||
|
@@ -79,14 +81,17 @@ describe('Test oauth', function () { | |
}) | ||
|
||
it('Should not login with an invalid password', async function () { | ||
const user = { username: server.store.user.username, password: 'mew_three' } | ||
const user = { username: '[email protected]', password: 'password' } | ||
const body = await server.login.login({ user, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | ||
|
||
expectInvalidCredentials(body) | ||
}) | ||
|
||
it('Should be able to login', async function () { | ||
await server.login.login({ expectedStatus: HttpStatusCode.OK_200 }) | ||
|
||
const user = { username: '[email protected]', password: 'AdvancedPassword' } | ||
await server.login.login({ user, expectedStatus: HttpStatusCode.OK_200 }) | ||
}) | ||
|
||
it('Should be able to login with an insensitive username', async function () { | ||
|
@@ -99,6 +104,14 @@ describe('Test oauth', function () { | |
const user3 = { username: 'ROOt', password: server.store.user.password } | ||
await server.login.login({ user: user3, expectedStatus: HttpStatusCode.OK_200 }) | ||
}) | ||
|
||
it('Should be able to login with an insensitive email when no similar emails exist', async function () { | ||
const user = { username: '[email protected]', password: server.store.user.password } | ||
await server.login.login({ user, expectedStatus: HttpStatusCode.OK_200 }) | ||
|
||
const user2 = { username: '[email protected]', password: server.store.user.password } | ||
await server.login.login({ user: user2, expectedStatus: HttpStatusCode.OK_200 }) | ||
}) | ||
}) | ||
|
||
describe('Logout', function () { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters