forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce single user per email, usernames case-insensitive (bluesky-so…
…cial#217) * Schemas and scaffolding for reset password methods * Initial handler for todo.adx.requestAccountPasswordReset * Initial handler for todo.adx.resetAccountPassword * Implement server mailer * Configure server for mailer and testing w/ mailer * Test happy path of pass reset, fix reset bug * Update lex to fix types bug for requestAccountPasswordReset * Fix handlebars reference to config getters * Test some negative password reset flows * Minor cleanup to pass reset * Tidy handlebars file with prettier, supporting double-quotes for html * Fix esbuild of server for mailer templates, fix test issue * Misc tidying for password reset * Misc tidying for password reset * Enforce single user per email, test unique email and username * Remove resolved TODO re: duplicate emails
- Loading branch information
Showing
6 changed files
with
69 additions
and
9 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,49 @@ describe('account', () => { | |
expect(res.data.username).toEqual(username) | ||
}) | ||
|
||
it('disallows duplicate email addresses and usernames', async () => { | ||
const res = await client.todo.adx.createInviteCode( | ||
{}, | ||
{ useCount: 2 }, | ||
{ | ||
headers: { authorization: util.adminAuth() }, | ||
encoding: 'application/json', | ||
}, | ||
) | ||
const inviteCode = res.data.code | ||
const email = '[email protected]' | ||
const username = 'bob.test' | ||
const password = 'test123' | ||
await client.todo.adx.createAccount( | ||
{}, | ||
{ email, username, password, inviteCode }, | ||
) | ||
|
||
await expect( | ||
client.todo.adx.createAccount( | ||
{}, | ||
{ | ||
email: email.toUpperCase(), | ||
username: 'carol.test', | ||
password, | ||
inviteCode, | ||
}, | ||
), | ||
).rejects.toThrow('Email already taken: [email protected]') | ||
|
||
await expect( | ||
client.todo.adx.createAccount( | ||
{}, | ||
{ | ||
email: '[email protected]', | ||
username: username.toUpperCase(), | ||
password, | ||
inviteCode, | ||
}, | ||
), | ||
).rejects.toThrow('Username already taken: BOB.TEST') | ||
}) | ||
|
||
it('fails on used up invite code', async () => { | ||
const promise = client.todo.adx.createAccount( | ||
{}, | ||
|
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