-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: "Allow Password Change for OAuth Users" setting is not honored i…
…n the "Forgot Password" flow (#32398)
- Loading branch information
1 parent
61e31aa
commit 6ac3607
Showing
7 changed files
with
34 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
Fixed issue with external users being able to reset their passwords even when the "Allow Password Change for OAuth Users" setting is disabled |
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ import { Users } from './fixtures/userStates'; | |
import { Registration } from './page-objects'; | ||
import { createCustomRole, deleteCustomRole } from './utils/custom-role'; | ||
import { getUserInfo } from './utils/getUserInfo'; | ||
import { parseMeteorResponse } from './utils/parseMeteorResponse'; | ||
import { setSettingValueById } from './utils/setSettingValueById'; | ||
import { test, expect, BaseTest } from './utils/test'; | ||
|
||
|
@@ -195,6 +196,30 @@ test.describe('SAML', () => { | |
}); | ||
}); | ||
|
||
test('Allow password change for OAuth users', async ({ api }) => { | ||
await test.step("should not send password reset mail if 'Allow Password Change for OAuth Users' setting is disabled", async () => { | ||
expect((await setSettingValueById(api, 'Accounts_AllowPasswordChangeForOAuthUsers', false)).status()).toBe(200); | ||
|
||
const response = await api.post('/method.call/sendForgotPasswordEmail', { | ||
message: JSON.stringify({ msg: 'method', id: 'id', method: 'sendForgotPasswordEmail', params: ['[email protected]'] }), | ||
}); | ||
const mailSent = await parseMeteorResponse<boolean>(response); | ||
expect(response.status()).toBe(200); | ||
expect(mailSent).toBe(false); | ||
}); | ||
|
||
await test.step("should send password reset mail if 'Allow Password Change for OAuth Users' setting is enabled", async () => { | ||
expect((await setSettingValueById(api, 'Accounts_AllowPasswordChangeForOAuthUsers', true)).status()).toBe(200); | ||
|
||
const response = await api.post('/method.call/sendForgotPasswordEmail', { | ||
message: JSON.stringify({ msg: 'method', id: 'id', method: 'sendForgotPasswordEmail', params: ['[email protected]'] }), | ||
}); | ||
const mailSent = await parseMeteorResponse<boolean>(response); | ||
expect(response.status()).toBe(200); | ||
expect(mailSent).toBe(true); | ||
}); | ||
}); | ||
|
||
const doLoginStep = async (page: Page, username: string, redirectUrl: string | null = '/home') => { | ||
await test.step('expect successful login', async () => { | ||
await poRegistration.btnLoginWithSaml.click(); | ||
|
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
File renamed without changes.