Skip to content

Commit 0d4d99e

Browse files
CodexXLinkinStars
authored andcommitted
feat: Add confirm password field in the install form
1 parent 0f47283 commit 0d4d99e

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

i18n/en_US.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,10 @@ ui:
16951695
msg: Password cannot be empty.
16961696
msg_min_length: Password must be at least 8 characters in length.
16971697
msg_max_length: Password must be at maximum 32 characters in length.
1698+
admin_confirm_password:
1699+
label: "Confirm Password"
1700+
text: "Please re-enter your password to confirm."
1701+
msg: "Confirm password does not match."
16981702
admin_email:
16991703
label: Email
17001704
text: You will need this email to log in.

ui/src/pages/Install/components/FourthStep/index.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
3636

3737
const checkValidated = (): boolean => {
3838
let bol = true;
39-
const { site_name, site_url, contact_email, name, password, email } = data;
39+
const {
40+
site_name,
41+
site_url,
42+
confirm_password,
43+
contact_email,
44+
name,
45+
password,
46+
email,
47+
} = data;
4048

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

161+
if (confirm_password.value !== password.value) {
162+
bol = false;
163+
data.confirm_password = {
164+
value: '',
165+
isInvalid: true,
166+
errorMsg: t('admin_confirm_password.msg'),
167+
};
168+
}
169+
153170
if (!email.value) {
154171
bol = false;
155172
data.email = {
@@ -316,6 +333,29 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
316333
</Form.Control.Feedback>
317334
</Form.Group>
318335

336+
<Form.Group controlId="confirm_password" className="mb-3">
337+
<Form.Label>{t('admin_confirm_password.label')}</Form.Label>
338+
<Form.Control
339+
required
340+
type="password"
341+
value={data.confirm_password.value}
342+
isInvalid={data.confirm_password.isInvalid}
343+
onChange={(e) => {
344+
changeCallback({
345+
confirm_password: {
346+
value: e.target.value,
347+
isInvalid: false,
348+
errorMsg: '',
349+
},
350+
});
351+
}}
352+
/>
353+
<Form.Text>{t('admin_confirm_password.text')}</Form.Text>
354+
<Form.Control.Feedback type="invalid">
355+
{data.confirm_password.errorMsg}
356+
</Form.Control.Feedback>
357+
</Form.Group>
358+
319359
<Form.Group controlId="email" className="mb-3">
320360
<Form.Label>{t('admin_email.label')}</Form.Label>
321361
<Form.Control

ui/src/pages/Install/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ const Index: FC = () => {
125125
isInvalid: false,
126126
errorMsg: '',
127127
},
128+
confirm_password: {
129+
value: '',
130+
isInvalid: false,
131+
errorMsg: '',
132+
},
128133
email: {
129134
value: '',
130135
isInvalid: false,

0 commit comments

Comments
 (0)