Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ability to view password #1980

Merged
merged 6 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest , windows-latest, macos-latest ]
os: [ ubuntu-latest , windows-latest ]
runs-on: ${{ matrix.os }}

steps:
Expand Down
3 changes: 3 additions & 0 deletions public/apps/account/password-reset-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function PasswordResetPanel(props: PasswordResetPanelProps) {
setIsCurrentPasswordInvalid(false);
}}
isInvalid={isCurrentPasswordInvalid}
type="dual"
/>
</FormRow>
<EuiSpacer />
Expand All @@ -141,6 +142,7 @@ export function PasswordResetPanel(props: PasswordResetPanelProps) {
setIsNewPasswordInvalid(false);
setIsRepeatNewPasswordInvalid(repeatNewPassword !== newPassword);
}}
type="dual"
isInvalid={isNewPasswordInvalid}
/>
</FormRow>
Expand All @@ -162,6 +164,7 @@ export function PasswordResetPanel(props: PasswordResetPanelProps) {
setRepeatNewPassword(value);
setIsRepeatNewPasswordInvalid(value !== newPassword);
}}
type="dual"
/>
</FormRow>

Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/panels/get-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function GetStarted(props: AppDependencies) {
selectedDataSource={dataSource}
/>
<EuiPageHeader>
<EuiTitle size="l">
<EuiTitle size="l" data-test-subj="get-started">
<h1>Get started</h1>
</EuiTitle>
<ExternalLinkButton text="Open in new window" href={buildHashUrl()} />
Expand Down
12 changes: 5 additions & 7 deletions public/apps/configuration/utils/password-edit-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import React from 'react';
import { CoreStart } from 'opensearch-dashboards/public';
import { EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiIcon } from '@elastic/eui';
import { EuiFieldPassword, EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui';
import { FormRow } from './form-row';
import { PASSWORD_INSTRUCTION } from '../../apps-constants';
import { getDashboardsInfo } from '../../../utils/dashboards-info-utils';
Expand Down Expand Up @@ -65,10 +65,9 @@ export function PasswordEditPanel(props: {
<EuiFlexGroup direction="row">
<EuiFlexItem grow={false}>
<FormRow headerText="Password" helpText={passwordHelpText}>
<EuiFieldText
<EuiFieldPassword
data-test-subj="password"
prepend={<EuiIcon type="lock" />}
type="password"
type="dual"
onChange={passwordChangeHandler}
/>
</FormRow>
Expand All @@ -82,10 +81,9 @@ export function PasswordEditPanel(props: {
headerText="Re-enter password"
helpText="The password must be identical to what you entered above."
>
<EuiFieldText
<EuiFieldPassword
data-test-subj="re-enter-password"
prepend={<EuiIcon type="lock" />}
type="password"
type="dual"
isInvalid={isRepeatPasswordInvalid}
onChange={repeatPasswordChangeHandler}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Password edit panel repeat password field update 1`] = `
<Fragment>
<EuiFlexGroup
direction="row"
>
<EuiFlexItem
grow={false}
>
<FormRow
headerText="Password"
helpText="Password should be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one digit, and one special character."
>
<EuiFieldPassword
compressed={false}
data-test-subj="password"
fullWidth={false}
isLoading={false}
onChange={[Function]}
type="dual"
/>
</FormRow>
<EuiFormRow
describedByIds={Array []}
display="row"
fullWidth={false}
hasChildLabel={true}
hasEmptyLabelSpace={false}
labelType="label"
>
<PasswordStrengthBar
password=""
/>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
<FormRow
headerText="Re-enter password"
helpText="The password must be identical to what you entered above."
>
<EuiFieldPassword
compressed={false}
data-test-subj="re-enter-password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
type="dual"
/>
</FormRow>
</Fragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('Password edit panel', () => {
updateIsInvalid={updateIsInvalid}
/>
);
expect(component).toMatchSnapshot();
const event = {
target: { value: 'dummy' },
} as React.ChangeEvent<HTMLInputElement>;
Expand Down
6 changes: 3 additions & 3 deletions public/apps/login/login-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
EuiForm,
EuiFormRow,
EuiHorizontalRule,
EuiFieldPassword,
} from '@elastic/eui';
import { CoreStart } from '../../../../../src/core/public';
import { ClientConfigType } from '../../types';
Expand Down Expand Up @@ -202,12 +203,11 @@ export function LoginPage(props: LoginPageDeps) {
);
formBody.push(
<EuiFormRow isInvalid={passwordValidationFailed}>
<EuiFieldText
<EuiFieldPassword
data-test-subj="password"
aria-label="password_input"
placeholder="Password"
prepend={<EuiIcon type="lock" />}
type="password"
type="dual"
onChange={(e) => setPassword(e.target.value)}
value={password}
isInvalid={usernameValidationFailed}
Expand Down
96 changes: 40 additions & 56 deletions public/apps/login/test/__snapshots__/login-page.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,16 @@ exports[`Login page renders renders with config value for multiauth 1`] = `
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -217,18 +215,16 @@ exports[`Login page renders renders with config value for multiauth with anonymo
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -388,18 +384,16 @@ exports[`Login page renders renders with config value with anonymous auth enable
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -509,18 +503,16 @@ exports[`Login page renders renders with config value with anonymous auth enable
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -630,18 +622,16 @@ exports[`Login page renders renders with config value: string 1`] = `
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -733,18 +723,16 @@ exports[`Login page renders renders with config value: string array 1`] = `
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -836,18 +824,16 @@ exports[`Login page renders renders with default value: string 1`] = `
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down Expand Up @@ -939,18 +925,16 @@ exports[`Login page renders renders with default value: string array 1`] = `
isInvalid={false}
labelType="label"
>
<EuiFieldText
<EuiFieldPassword
aria-label="password_input"
compressed={false}
data-test-subj="password"
fullWidth={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
placeholder="Password"
prepend={
<EuiIcon
type="lock"
/>
}
type="password"
type="dual"
value=""
/>
</EuiFormRow>
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/oidc/oidc_auth_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
localStorage.setItem('opendistro::security::tenant::saved', '""');
localStorage.setItem('home:newThemeModal:show', 'false');

cy.get('h1.euiTitle--large').contains('Get started');
cy.get('[data-test-subj="get-started"]').should('exist');
});

it('Tenancy persisted after logout in OIDC', () => {
Expand All @@ -107,7 +107,7 @@
localStorage.setItem('home:newThemeModal:show', 'false');

cy.get('#private').should('be.enabled');
cy.get('#private').click({ force: true });

Check warning on line 110 in test/cypress/e2e/oidc/oidc_auth_test.spec.js

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Do not use force on click and type calls

Check warning on line 110 in test/cypress/e2e/oidc/oidc_auth_test.spec.js

View workflow job for this annotation

GitHub Actions / Run unit tests (windows-latest)

Do not use force on click and type calls

cy.get('button[data-test-subj="confirm"]').click();

Expand Down
Loading