ywana-core8 0.1.21 → 0.1.23
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.
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +10 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +10 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/textfield.js +1 -1
- package/src/widgets/login/ResetPasswordBox.js +9 -8
package/package.json
CHANGED
package/src/html/textfield.js
CHANGED
@@ -12,7 +12,7 @@ import './textarea.css'
|
|
12
12
|
export const TextField = (props) => {
|
13
13
|
|
14
14
|
const site = useContext(SiteContext)
|
15
|
-
const { id, type = 'text', className, label, labelPosition = 'top', placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick, onFocus, onBlur, autoComplete="
|
15
|
+
const { id, type = 'text', className, label, labelPosition = 'top', placeholder, value, outlined, readOnly = false, canClear = true, onChange, onEnter, onClick, onFocus, onBlur, autoComplete="one-time-code" } = props
|
16
16
|
|
17
17
|
function onKeyPress(event) {
|
18
18
|
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
|
@@ -20,14 +20,14 @@ export const ResetPasswordBox = ({ title, userRequired = true, oldPwdRequired =
|
|
20
20
|
function validateUser(user) {
|
21
21
|
let error = ""
|
22
22
|
const isValid = user && user.length > 0
|
23
|
-
error =
|
23
|
+
if (!isValid) error = "User is required."
|
24
24
|
return [isValid, error]
|
25
25
|
}
|
26
26
|
|
27
27
|
function validateOldPassword(oldPassword) {
|
28
28
|
let error = ""
|
29
29
|
const isValid = oldPassword && oldPassword.length > 0
|
30
|
-
error =
|
30
|
+
if (!isValid) error = "Old password is required."
|
31
31
|
return [isValid, error]
|
32
32
|
}
|
33
33
|
|
@@ -35,7 +35,7 @@ export const ResetPasswordBox = ({ title, userRequired = true, oldPwdRequired =
|
|
35
35
|
|
36
36
|
const hasPassword = password && password.length > 0
|
37
37
|
if (!hasPassword) {
|
38
|
-
const error =
|
38
|
+
const error = "Password is required"
|
39
39
|
return [false, error]
|
40
40
|
}
|
41
41
|
|
@@ -50,7 +50,7 @@ export const ResetPasswordBox = ({ title, userRequired = true, oldPwdRequired =
|
|
50
50
|
function validatePasswordsMatch(password1, password2) {
|
51
51
|
let error = ""
|
52
52
|
const isValid = password1 === password2
|
53
|
-
error =
|
53
|
+
if (!isValid) error = "Passwords do not match."
|
54
54
|
return [isValid, error]
|
55
55
|
}
|
56
56
|
|
@@ -108,6 +108,7 @@ export const ResetPasswordBox = ({ title, userRequired = true, oldPwdRequired =
|
|
108
108
|
const password1Style = errors.password1 ? "error" : ""
|
109
109
|
const password2Style = errors.password2 ? "error" : ""
|
110
110
|
|
111
|
+
console.log("ResetPasswordBox", errors)
|
111
112
|
return (
|
112
113
|
<div className="reset-password-box">
|
113
114
|
<header>
|
@@ -116,18 +117,18 @@ export const ResetPasswordBox = ({ title, userRequired = true, oldPwdRequired =
|
|
116
117
|
<main className={`reset-password-form`}>
|
117
118
|
|
118
119
|
{userRequired ? <TextField id="user" className={userStyle} outlined icon="person" label={userLabel} lapse={100} onChange={changeField} onEnter={ok} /> : null}
|
119
|
-
{userRequired ? errors.user ? <div className="error-message">{errors.user}</div> : null : null}
|
120
|
+
{userRequired ? errors.user ? <div className="error-message"><Text>{errors.user}</Text></div> : null : null}
|
120
121
|
|
121
122
|
{oldPwdRequired ? <TextField id="oldPassword" className={oldPasswordStyle} outlined icon="lock" type="password" label="Old Password" lapse={100} onChange={changeField} onEnter={ok} /> : null}
|
122
|
-
{oldPwdRequired ? errors.oldPassword ? <div className="error-message">{errors.oldPassword}</div> : null : null}
|
123
|
+
{oldPwdRequired ? errors.oldPassword ? <div className="error-message"><Text>{errors.oldPassword}</Text></div> : null : null}
|
123
124
|
|
124
125
|
<TextField id="password1" className={password1Style} outlined icon="lock" type="password" label={passwordLabel} lapse={100} onChange={changeField} onEnter={ok} />
|
125
|
-
{ errors.password1 ? <div className="error-message">{errors.password1}</div> : null }
|
126
|
+
{ errors.password1 ? <div className="error-message"><Text>{errors.password1}</Text></div> : null }
|
126
127
|
|
127
128
|
{children}
|
128
129
|
|
129
130
|
<TextField id="password2" className={password2Style} outlined icon="lock" type="password" label={password2Label} lapse={100} onChange={changeField} onEnter={ok} />
|
130
|
-
{ errors.password2 ? <div className="error-message">{errors.password2}</div> : null }
|
131
|
+
{ errors.password2 ? <div className="error-message"><Text>{errors.password2}</Text></div> : null }
|
131
132
|
|
132
133
|
</main>
|
133
134
|
<footer>
|