ui-soxo-bootstrap-core 2.6.1 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,7 +39,7 @@ function ChangePassword({ history }) {
|
|
|
39
39
|
|
|
40
40
|
const [loading, setLoading] = useState(false);
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
|
|
44
44
|
const onFinish = (values) => {
|
|
45
45
|
|
|
@@ -55,34 +55,24 @@ function ChangePassword({ history }) {
|
|
|
55
55
|
confirm_password: values.conpassword
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var msg = Object.values(result)
|
|
65
|
-
|
|
66
|
-
if (msg[0] === 'INCORRECT PASSWORD') {
|
|
67
|
-
//If current Password is entered wrong
|
|
68
|
-
message.error('Incorrect Password')
|
|
69
|
-
setLoading(false);
|
|
70
|
-
return false
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
58
|
+
ApiUtils.post({
|
|
59
|
+
url: `users/change-password`,
|
|
60
|
+
formBody,
|
|
61
|
+
hideError: true
|
|
62
|
+
})
|
|
63
|
+
.then((result) => {
|
|
73
64
|
|
|
74
65
|
setLoading(false);
|
|
75
66
|
|
|
76
67
|
history.goBack();
|
|
77
68
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
message.error(error.result || error.message)
|
|
69
|
+
// Update successful.
|
|
70
|
+
message.success(result.result || 'Your password has been updated!');
|
|
71
|
+
|
|
72
|
+
}).catch(function (error) {
|
|
73
|
+
|
|
74
|
+
// An error happened.
|
|
75
|
+
message.warning(error.result || error.message);
|
|
86
76
|
|
|
87
77
|
setLoading(false);
|
|
88
78
|
|
|
@@ -127,7 +127,8 @@ function LoginPhone({ history, appSettings }) {
|
|
|
127
127
|
const lastPasswordChange = otherDetails?.last_password_change;
|
|
128
128
|
|
|
129
129
|
if (lastPasswordChange) {
|
|
130
|
-
const
|
|
130
|
+
const onlyDate = new Date(lastPasswordChange).toISOString().split('T')[0];
|
|
131
|
+
const passwordExpiryDate = new Date(onlyDate);
|
|
131
132
|
passwordExpiryDate.setDate(passwordExpiryDate.getDate() + PASSWORD_VALIDITY_DAYS);
|
|
132
133
|
|
|
133
134
|
const passwordStatus = checkExpiryStatus({
|
|
@@ -335,10 +336,10 @@ function LoginPhone({ history, appSettings }) {
|
|
|
335
336
|
if (result.success) {
|
|
336
337
|
// for expiry_time
|
|
337
338
|
startFromExpiry(result?.expiry_time);
|
|
338
|
-
// if the api is sucess then go for otpverification step
|
|
339
|
-
setotpVerification(true);
|
|
340
339
|
// set button loading false
|
|
341
340
|
setLoading(false);
|
|
341
|
+
// if the api is sucess then go for otpverification step
|
|
342
|
+
setotpVerification(true);
|
|
342
343
|
} else {
|
|
343
344
|
setLoading(false);
|
|
344
345
|
message.error(result.message);
|
|
@@ -806,8 +807,8 @@ function LoginPhone({ history, appSettings }) {
|
|
|
806
807
|
title={expiredPassword ? 'Password Expired' : 'Forgot Password'}
|
|
807
808
|
subtitle={
|
|
808
809
|
expiredPassword
|
|
809
|
-
? '
|
|
810
|
-
: 'Enter your username
|
|
810
|
+
? 'Your password has expired. Select a preferred communication method to receive the One-Time Password (OTP) to continue.'
|
|
811
|
+
: 'Enter your username and Select a preferred communication method to receive the One-Time Password (OTP) to continue..'
|
|
811
812
|
}
|
|
812
813
|
buttonText={expiredPassword ? 'Send Reset Link' : 'Reset Password'}
|
|
813
814
|
/>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @param {boolean} disabledUserName - Disable username field
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import React, { useState, useEffect } from 'react';
|
|
20
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
21
21
|
import { Divider, Form, Input, message } from 'antd';
|
|
22
22
|
import { Button } from '../../elements';
|
|
23
23
|
import CommunicationModeSelection from './commnication-mode-selection';
|
|
@@ -36,6 +36,9 @@ function ResetPassword({ onBack, title, subtitle, buttonText, defaultUsername, d
|
|
|
36
36
|
|
|
37
37
|
const [form] = Form.useForm();
|
|
38
38
|
|
|
39
|
+
// Ref to username input auto focus
|
|
40
|
+
const inputRef = useRef(null);
|
|
41
|
+
|
|
39
42
|
// Pre-fills username if provided and disabled.
|
|
40
43
|
useEffect(() => {
|
|
41
44
|
if (disabledUserName && defaultUsername) {
|
|
@@ -43,6 +46,10 @@ function ResetPassword({ onBack, title, subtitle, buttonText, defaultUsername, d
|
|
|
43
46
|
}
|
|
44
47
|
}, [disabledUserName, defaultUsername]);
|
|
45
48
|
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
inputRef.current?.focus();
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
46
53
|
/**
|
|
47
54
|
* Sends forgot password request to backend.
|
|
48
55
|
* Payload: { mode, username, user_type: 'staff' }
|
|
@@ -83,18 +90,12 @@ function ResetPassword({ onBack, title, subtitle, buttonText, defaultUsername, d
|
|
|
83
90
|
return (
|
|
84
91
|
<motion.div
|
|
85
92
|
className="forgot-password-container"
|
|
86
|
-
initial={{ opacity: 0, y:
|
|
93
|
+
initial={{ opacity: 0, y: 30 }}
|
|
87
94
|
animate={{ opacity: 1, y: 0 }}
|
|
88
|
-
exit={{ opacity: 0, y: -
|
|
95
|
+
exit={{ opacity: 0, y: -20 }}
|
|
89
96
|
transition={{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
ease: [0.22, 0.08, 0.26, 1],
|
|
93
|
-
},
|
|
94
|
-
opacity: {
|
|
95
|
-
duration: 0.45,
|
|
96
|
-
ease: 'easeOut',
|
|
97
|
-
},
|
|
97
|
+
duration: 0.30,
|
|
98
|
+
ease: 'easeOut',
|
|
98
99
|
}}
|
|
99
100
|
>
|
|
100
101
|
<h3 className="password-title">{title}</h3>
|
|
@@ -102,7 +103,7 @@ function ResetPassword({ onBack, title, subtitle, buttonText, defaultUsername, d
|
|
|
102
103
|
<Divider />
|
|
103
104
|
<Form layout="vertical" form={form} onFinish={handleSendForgetPassword}>
|
|
104
105
|
<Form.Item label="Username" name="username" rules={[{ required: true, message: 'Please input your username' }]}>
|
|
105
|
-
<Input placeholder="Enter your username" disabled={disabledUserName} />
|
|
106
|
+
<Input placeholder="Enter your username" disabled={disabledUserName} ref={inputRef}/>
|
|
106
107
|
</Form.Item>
|
|
107
108
|
|
|
108
109
|
<CommunicationModeSelection communicationMode={communicationMode} setCommunicationMode={setCommunicationMode} modeError={modeError} />
|