Skip to content

Commit

Permalink
Allow passwords to be visible on security screens (#77394)
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego authored Sep 15, 2020
1 parent e7d8ea3 commit 1eb44e1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ describe('<AccountManagementPage>', () => {
wrapper.update();
});

expect(wrapper.find('EuiFieldText[data-test-subj="currentPassword"]')).toHaveLength(1);
expect(wrapper.find('EuiFieldText[data-test-subj="newPassword"]')).toHaveLength(1);
expect(wrapper.find('EuiFieldPassword[data-test-subj="currentPassword"]')).toHaveLength(1);
expect(wrapper.find('EuiFieldPassword[data-test-subj="newPassword"]')).toHaveLength(1);
});

it(`does not display change password form for users in the saml realm`, async () => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export class LoginForm extends Component<Props, State> {
id="password"
name="password"
data-test-subj="loginPassword"
type={'dual'}
value={this.state.password}
onChange={this.onPasswordChange}
disabled={!this.isLoadingState(LoadingStateType.None)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { EuiFieldText } from '@elastic/eui';
import { EuiFieldPassword } from '@elastic/eui';
import { ReactWrapper } from 'enzyme';
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
Expand All @@ -14,15 +14,15 @@ import { coreMock } from '../../../../../../../../src/core/public/mocks';
import { userAPIClientMock } from '../../index.mock';

function getCurrentPasswordField(wrapper: ReactWrapper<any>) {
return wrapper.find(EuiFieldText).filter('[data-test-subj="currentPassword"]');
return wrapper.find(EuiFieldPassword).filter('[data-test-subj="currentPassword"]');
}

function getNewPasswordField(wrapper: ReactWrapper<any>) {
return wrapper.find(EuiFieldText).filter('[data-test-subj="newPassword"]');
return wrapper.find(EuiFieldPassword).filter('[data-test-subj="newPassword"]');
}

function getConfirmPasswordField(wrapper: ReactWrapper<any>) {
return wrapper.find(EuiFieldText).filter('[data-test-subj="confirmNewPassword"]');
return wrapper.find(EuiFieldPassword).filter('[data-test-subj="confirmNewPassword"]');
}

describe('<ChangePasswordForm>', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {
EuiButton,
EuiButtonEmpty,
EuiFieldText,
EuiFieldPassword,
EuiFlexGroup,
EuiFlexItem,
EuiForm,
Expand Down Expand Up @@ -72,10 +72,10 @@ export class ChangePasswordForm extends Component<Props, State> {
/>
}
>
<EuiFieldText
<EuiFieldPassword
autoComplete="off"
data-test-subj="currentPassword"
type="password"
type="dual"
value={this.state.currentPassword}
onChange={this.onCurrentPasswordChange}
disabled={this.state.changeInProgress}
Expand All @@ -100,10 +100,10 @@ export class ChangePasswordForm extends Component<Props, State> {
/>
}
>
<EuiFieldText
<EuiFieldPassword
autoComplete="new-password"
data-test-subj="newPassword"
type="password"
type="dual"
value={this.state.newPassword}
onChange={this.onNewPasswordChange}
disabled={this.state.changeInProgress}
Expand All @@ -120,10 +120,10 @@ export class ChangePasswordForm extends Component<Props, State> {
/>
}
>
<EuiFieldText
<EuiFieldPassword
autoComplete="new-password"
data-test-subj="confirmNewPassword"
type="password"
type="dual"
value={this.state.confirmPassword}
onChange={this.onConfirmPasswordChange}
disabled={this.state.changeInProgress}
Expand Down

0 comments on commit 1eb44e1

Please sign in to comment.