Skip to content

feat: Add confirm password field in the application install form #1252

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions i18n/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,10 @@ ui:
msg: Password cannot be empty.
msg_min_length: Password must be at least 8 characters in length.
msg_max_length: Password must be at maximum 32 characters in length.
admin_confirm_password:
label: "Confirm Password"
text: "Please re-enter your password to confirm."
msg: "Confirm password does not match."
admin_email:
label: Email
text: You will need this email to log in.
Expand Down Expand Up @@ -2303,6 +2307,5 @@ ui:
user_deleted: This user has been deleted.
badge_activated: This badge has been activated.
badge_inactivated: This badge has been inactivated.
users_deleted: These users have been deleted.
posts_deleted: These questions have been deleted.
answers_deleted: These answers have been deleted.


42 changes: 41 additions & 1 deletion ui/src/pages/Install/components/FourthStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {

const checkValidated = (): boolean => {
let bol = true;
const { site_name, site_url, contact_email, name, password, email } = data;
const {
site_name,
site_url,
confirm_password,
contact_email,
name,
password,
email,
} = data;

if (!site_name.value) {
bol = false;
Expand Down Expand Up @@ -150,6 +158,15 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
};
}

if (confirm_password.value !== password.value) {
bol = false;
data.confirm_password = {
value: '',
isInvalid: true,
errorMsg: t('admin_confirm_password.msg'),
};
}

if (!email.value) {
bol = false;
data.email = {
Expand Down Expand Up @@ -316,6 +333,29 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
</Form.Control.Feedback>
</Form.Group>

<Form.Group controlId="confirm_password" className="mb-3">
<Form.Label>{t('admin_confirm_password.label')}</Form.Label>
<Form.Control
required
type="password"
value={data.confirm_password.value}
isInvalid={data.confirm_password.isInvalid}
onChange={(e) => {
changeCallback({
confirm_password: {
value: e.target.value,
isInvalid: false,
errorMsg: '',
},
});
}}
/>
<Form.Text>{t('admin_confirm_password.text')}</Form.Text>
<Form.Control.Feedback type="invalid">
{data.confirm_password.errorMsg}
</Form.Control.Feedback>
</Form.Group>

<Form.Group controlId="email" className="mb-3">
<Form.Label>{t('admin_email.label')}</Form.Label>
<Form.Control
Expand Down
5 changes: 5 additions & 0 deletions ui/src/pages/Install/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ const Index: FC = () => {
isInvalid: false,
errorMsg: '',
},
confirm_password: {
value: '',
isInvalid: false,
errorMsg: '',
},
email: {
value: '',
isInvalid: false,
Expand Down