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
- console.log(user);
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
- ApiUtils.post({
59
- url: `users/change-password`,
60
- formBody,
61
- hideError: true
62
- }).then((result) => {
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
- // Update successful.
79
- message.success('Your password has been updated!')
80
- }
81
-
82
- }).catch(function (error) {
83
-
84
- // An error happened.
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 passwordExpiryDate = new Date(lastPasswordChange);
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
- ? 'Enter your username and choose your preferred OTP method to receive a reset link.'
810
- : 'Enter your username to reset your password and select your preferred OTP method.'
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: 70 }}
93
+ initial={{ opacity: 0, y: 30 }}
87
94
  animate={{ opacity: 1, y: 0 }}
88
- exit={{ opacity: 0, y: -50 }}
95
+ exit={{ opacity: 0, y: -20 }}
89
96
  transition={{
90
- y: {
91
- duration: 1,
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} />
@@ -153,5 +153,6 @@ export async function ApiCall({ url, formBody, method, settings, ...props }) {
153
153
  return result;
154
154
  } catch (err) {
155
155
  console.error('Login error -->', err?.message);
156
+ throw err;
156
157
  }
157
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"