-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into node-337-our-help-link-from-the-schedule-n…
…ode-is
- Loading branch information
Showing
7 changed files
with
61 additions
and
18 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 |
---|---|---|
|
@@ -54,7 +54,7 @@ | |
"workflow" | ||
], | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=16.9" | ||
}, | ||
"files": [ | ||
"bin", | ||
|
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ import { | |
randomValidPassword, | ||
} from './shared/random'; | ||
import * as testDb from './shared/testDb'; | ||
import { setCurrentAuthenticationMethod } from '@/sso/ssoHelpers'; | ||
|
||
jest.mock('@/UserManagement/email/NodeMailer'); | ||
|
||
|
@@ -74,6 +75,35 @@ describe('POST /forgot-password', () => { | |
expect(storedOwner.resetPasswordToken).toBeNull(); | ||
}); | ||
|
||
test('should fail if SAML is authentication method', async () => { | ||
await setCurrentAuthenticationMethod('saml'); | ||
config.set('userManagement.emails.mode', 'smtp'); | ||
const member = await testDb.createUser({ | ||
email: '[email protected]', | ||
globalRole: globalMemberRole, | ||
}); | ||
|
||
await authlessAgent.post('/forgot-password').send({ email: member.email }).expect(403); | ||
|
||
const storedOwner = await Db.collections.User.findOneByOrFail({ email: member.email }); | ||
expect(storedOwner.resetPasswordToken).toBeNull(); | ||
await setCurrentAuthenticationMethod('email'); | ||
}); | ||
|
||
test('should succeed if SAML is authentication method and requestor is owner', async () => { | ||
await setCurrentAuthenticationMethod('saml'); | ||
config.set('userManagement.emails.mode', 'smtp'); | ||
|
||
const response = await authlessAgent.post('/forgot-password').send({ email: owner.email }); | ||
|
||
expect(response.statusCode).toBe(200); | ||
expect(response.body).toEqual({}); | ||
|
||
const storedOwner = await Db.collections.User.findOneByOrFail({ email: owner.email }); | ||
expect(storedOwner.resetPasswordToken).not.toBeNull(); | ||
await setCurrentAuthenticationMethod('email'); | ||
}); | ||
|
||
test('should fail with invalid inputs', async () => { | ||
config.set('userManagement.emails.mode', 'smtp'); | ||
|
||
|