Skip to content

Commit bcb4d8e

Browse files
authored
fix(ui): change password button being hidden and unlock button being shown incorrectly on account page (#14220)
Fixes #14208 When you click change password only the Cancel button should still show otherwise it looks confusing as "Force Unlock" (currently shown) is visible as if it were a submit This ensures only cancel is visible
1 parent b26129c commit bcb4d8e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/ui/src/views/Edit/Auth/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ export const Auth: React.FC<Props> = (props) => {
237237
<Button
238238
buttonStyle="secondary"
239239
disabled={disabled}
240+
id="cancel-change-password"
240241
onClick={() => handleChangePassword(false)}
241242
size="medium"
242243
>
@@ -257,10 +258,11 @@ export const Auth: React.FC<Props> = (props) => {
257258
{t('authentication:changePassword')}
258259
</Button>
259260
)}
260-
{operation === 'update' && hasPermissionToUnlock && (
261+
{!changingPassword && operation === 'update' && hasPermissionToUnlock && (
261262
<Button
262263
buttonStyle="secondary"
263264
disabled={disabled || !showUnlock}
265+
id="force-unlock"
264266
onClick={() => void unlock()}
265267
size="medium"
266268
>

test/auth/e2e.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,14 @@ describe('Auth', () => {
226226
test('should allow change password', async () => {
227227
await page.goto(url.account)
228228
const emailBeforeSave = await page.locator('#field-email').inputValue()
229+
await expect(page.locator('#force-unlock')).toBeVisible()
230+
229231
await page.locator('#change-password').click()
230232
await page.locator('#field-password').fill('password')
233+
234+
await expect(page.locator('#change-password')).toBeHidden()
235+
236+
await expect(page.locator('#cancel-change-password')).toBeVisible()
231237
// should fail to save without confirm password
232238
await page.locator('#action-save').click()
233239
await expect(

0 commit comments

Comments
 (0)