Skip to content

Only render change password fields if user signs up locally #3095

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

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all 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
84 changes: 44 additions & 40 deletions client/modules/User/components/AccountForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,46 +128,50 @@ function AccountForm() {
</p>
)}
</Field>
<Field name="currentPassword">
{(field) => (
<p className="form__field">
<label htmlFor="current password" className="form__label">
{t('AccountForm.CurrentPassword')}
</label>
<input
className="form__input"
aria-label={t('AccountForm.CurrentPasswordARIA')}
type="password"
id="currentPassword"
autoComplete="current-password"
{...field.input}
/>
{field.meta.touched && field.meta.error && (
<span className="form-error">{field.meta.error}</span>
)}
</p>
)}
</Field>
<Field name="newPassword">
{(field) => (
<p className="form__field">
<label htmlFor="new password" className="form__label">
{t('AccountForm.NewPassword')}
</label>
<input
className="form__input"
aria-label={t('AccountForm.NewPasswordARIA')}
type="password"
id="newPassword"
autoComplete="new-password"
{...field.input}
/>
{field.meta.touched && field.meta.error && (
<span className="form-error">{field.meta.error}</span>
)}
</p>
)}
</Field>
{user.github === undefined && user.google === undefined && (
<Field name="currentPassword">
{(field) => (
<p className="form__field">
<label htmlFor="current password" className="form__label">
{t('AccountForm.CurrentPassword')}
</label>
<input
className="form__input"
aria-label={t('AccountForm.CurrentPasswordARIA')}
type="password"
id="currentPassword"
autoComplete="current-password"
{...field.input}
/>
{field.meta.touched && field.meta.error && (
<span className="form-error">{field.meta.error}</span>
)}
</p>
)}
</Field>
)}
{user.github === undefined && user.google === undefined && (
<Field name="newPassword">
{(field) => (
<p className="form__field">
<label htmlFor="new password" className="form__label">
{t('AccountForm.NewPassword')}
</label>
<input
className="form__input"
aria-label={t('AccountForm.NewPasswordARIA')}
type="password"
id="newPassword"
autoComplete="new-password"
{...field.input}
/>
{field.meta.touched && field.meta.error && (
<span className="form-error">{field.meta.error}</span>
)}
</p>
)}
</Field>
)}
<Button type="submit" disabled={submitting || invalid}>
{t('AccountForm.SubmitSaveAllSettings')}
</Button>
Expand Down
Loading