-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable updateEmail with no token & no app password (#1715)
* dont allow updateEmail with an app password * re-enable email updates
- Loading branch information
Showing
2 changed files
with
6 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,50 +60,28 @@ describe('email confirmation', () => { | |
expect(session.data.emailConfirmed).toEqual(false) | ||
}) | ||
|
||
it('disallows email update when unverified', async () => { | ||
it('allows email update without token when unverified', async () => { | ||
const res = await agent.api.com.atproto.server.requestEmailUpdate( | ||
undefined, | ||
{ headers: sc.getHeaders(alice.did) }, | ||
) | ||
expect(res.data.tokenRequired).toBe(false) | ||
|
||
const attempt = agent.api.com.atproto.server.updateEmail( | ||
await agent.api.com.atproto.server.updateEmail( | ||
{ | ||
email: '[email protected]', | ||
}, | ||
{ headers: sc.getHeaders(alice.did), encoding: 'application/json' }, | ||
) | ||
await expect(attempt).rejects.toThrow() | ||
const session = await agent.api.com.atproto.server.getSession( | ||
{}, | ||
{ headers: sc.getHeaders(alice.did) }, | ||
) | ||
expect(session.data.email).toEqual(alice.email) | ||
expect(session.data.email).toEqual('new-alice@example.com') | ||
expect(session.data.emailConfirmed).toEqual(false) | ||
alice.email = session.data.email | ||
}) | ||
|
||
// it('allows email update without token when unverified', async () => { | ||
// const res = await agent.api.com.atproto.server.requestEmailUpdate( | ||
// undefined, | ||
// { headers: sc.getHeaders(alice.did) }, | ||
// ) | ||
// expect(res.data.tokenRequired).toBe(false) | ||
|
||
// await agent.api.com.atproto.server.updateEmail( | ||
// { | ||
// email: '[email protected]', | ||
// }, | ||
// { headers: sc.getHeaders(alice.did), encoding: 'application/json' }, | ||
// ) | ||
// const session = await agent.api.com.atproto.server.getSession( | ||
// {}, | ||
// { headers: sc.getHeaders(alice.did) }, | ||
// ) | ||
// expect(session.data.email).toEqual('[email protected]') | ||
// expect(session.data.emailConfirmed).toEqual(false) | ||
// alice.email = session.data.email | ||
// }) | ||
|
||
let confirmToken | ||
|
||
it('requests email confirmation', async () => { | ||
|