Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Accounts Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Accounts Web
Commits
e842f96b
Commit
e842f96b
authored
Jul 24, 2023
by
铃兰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加修改用户名/邮箱/密码的验证页面
parent
ed5a975d
Pipeline
#22768
passed with stages
in 1 minute and 38 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
39 deletions
+39
-39
i18n.json
i18n.json
+1
-1
src/components/PasswordForm.js
src/components/PasswordForm.js
+4
-4
src/components/UserNameForm.js
src/components/UserNameForm.js
+27
-27
src/routes/Profiles.js
src/routes/Profiles.js
+7
-7
No files found.
i18n.json
View file @
e842f96b
...
@@ -192,7 +192,7 @@
...
@@ -192,7 +192,7 @@
"Seconds"
:
"秒后退出"
,
"Seconds"
:
"秒后退出"
,
"TemporaryPrompt"
:
"改名已关闭。下次将在10月1日开启。"
,
"TemporaryPrompt"
:
"改名已关闭。下次将在10月1日开启。"
,
"ChangeSuccess"
:
"修改成功,请重新登录生效。"
,
"ChangeSuccess"
:
"修改成功,请重新登录生效。"
,
"EmailChangeSuccess"
:
"请查看邮件完成修改"
,
"EmailChangeSuccess"
:
"请查看邮件完成修改
。
"
,
"没毛用"
:
"防逗号报错,上线删"
"没毛用"
:
"防逗号报错,上线删"
}
}
}
}
src/components/PasswordForm.js
View file @
e842f96b
...
@@ -39,7 +39,7 @@ class EmailForm extends React.Component {
...
@@ -39,7 +39,7 @@ class EmailForm extends React.Component {
};
};
handleCountdown
=
()
=>
{
handleCountdown
=
()
=>
{
// 倒计时减1
// 倒计时减1
this
.
setState
(
(
prevState
)
=>
({
countdown
:
prevState
.
countdown
-
1
}));
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
if
(
this
.
state
.
countdown
===
0
)
{
if
(
this
.
state
.
countdown
===
0
)
{
// 清除倒计时
// 清除倒计时
clearInterval
(
this
.
countdownTimer
);
clearInterval
(
this
.
countdownTimer
);
...
@@ -142,12 +142,12 @@ class EmailForm extends React.Component {
...
@@ -142,12 +142,12 @@ class EmailForm extends React.Component {
return
(
return
(
<
div
>
<
div
>
{
inCountdown
?
(
{
inCountdown
?
(
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
alignItems
:
'
center
'
,
height
:
'
100vh
'
}}
>
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
alignItems
:
'
center
'
,
height
:
'
100vh
'
}}
>
<
div
style
=
{{
flex
:
9
/
10
,
textAlign
:
'
center
'
}}
>
<
div
style
=
{{
flex
:
9
/
10
,
textAlign
:
'
center
'
}}
>
<
h3
>
{
ChangeSuccessText
}
<
/h3
>
<
h3
>
{
ChangeSuccessText
}
<
/h3
>
<
h3
>
<
h3
>
{
loggingOutInText
}
{
loggingOutInText
}
<
span
style
=
{{
color
:
'
#4da9ee
'
,
fontSize
:
'
2em
'
}}
>&
nbsp
;{
`
${
countdown
}
`
}
<
/span
>
<
span
style
=
{{
color
:
'
#4da9ee
'
,
fontSize
:
'
2em
'
}}
>&
nbsp
;{
`
${
countdown
}
`
}
<
/span
>
<
span
>&
nbsp
;{
secondsText
}
<
/span
>
<
span
>&
nbsp
;{
secondsText
}
<
/span
>
<
/h3
>
<
/h3
>
<
br
/>
<
br
/>
...
...
src/components/UserNameForm.js
View file @
e842f96b
import
{
Button
,
Form
,
Input
}
from
'
antd
'
;
import
{
Button
,
Form
,
Input
}
from
'
antd
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
connect
}
from
'
react-redux
'
;
import
SubmitButton
from
'
./SubmitButton
'
;
import
SubmitButton
from
'
./SubmitButton
'
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
formItemLayout
=
{
const
formItemLayout
=
{
labelCol
:
{
span
:
4
},
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
15
},
wrapperCol
:
{
span
:
15
},
};
};
...
@@ -16,7 +16,7 @@ class EmailForm extends React.Component {
...
@@ -16,7 +16,7 @@ class EmailForm extends React.Component {
inCountdown
:
false
,
// Whether the countdown is active
inCountdown
:
false
,
// Whether the countdown is active
};
};
onSubmit
=
(
e
)
=>
{
onSubmit
=
(
e
)
=>
{
const
{
form
,
dispatch
,
user
:
{
id
}
}
=
this
.
props
;
const
{
form
,
dispatch
,
user
:
{
id
}
}
=
this
.
props
;
if
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -24,21 +24,21 @@ class EmailForm extends React.Component {
...
@@ -24,21 +24,21 @@ class EmailForm extends React.Component {
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
log
(
'
Received values of form:
'
,
values
);
console
.
log
(
'
Received values of form:
'
,
values
);
const
{
username
,
password
}
=
values
;
const
{
username
,
password
}
=
values
;
dispatch
({
type
:
'
user/updateAccount
'
,
payload
:
{
username
,
password
,
user_id
:
id
}
});
dispatch
({
type
:
'
user/updateAccount
'
,
payload
:
{
username
,
password
,
user_id
:
id
}
});
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
}
}
});
});
};
};
handleCountdown
=
()
=>
{
handleCountdown
=
()
=>
{
// 倒计时减1
// 倒计时减1
this
.
setState
(
(
prevState
)
=>
({
countdown
:
prevState
.
countdown
-
1
}));
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
if
(
this
.
state
.
countdown
===
0
)
{
if
(
this
.
state
.
countdown
===
0
)
{
// 清除倒计时
// 清除倒计时
clearInterval
(
this
.
countdownTimer
);
clearInterval
(
this
.
countdownTimer
);
// 设置倒计时状态为false
// 设置倒计时状态为false
this
.
setState
({
inCountdown
:
false
});
this
.
setState
({
inCountdown
:
false
});
// 倒计时结束后调用退出
// 倒计时结束后调用退出
this
.
handleLogout
();
this
.
handleLogout
();
}
}
...
@@ -55,12 +55,12 @@ class EmailForm extends React.Component {
...
@@ -55,12 +55,12 @@ class EmailForm extends React.Component {
};
};
handleLogoutNow
=
()
=>
{
handleLogoutNow
=
()
=>
{
this
.
setState
({
countdown
:
0
},
()
=>
{
this
.
setState
({
countdown
:
0
},
()
=>
{
this
.
handleLogout
();
this
.
handleLogout
();
});
});
};
};
checkPassword
=
(
rule
,
value
,
callback
)
=>
{
checkPassword
=
(
rule
,
value
,
callback
)
=>
{
const
{
form
,
messages
}
=
this
.
props
;
const
{
form
,
messages
}
=
this
.
props
;
// const { intl: { messages } } = this.context;
// const { intl: { messages } } = this.context;
if
(
value
&&
value
!==
form
.
getFieldValue
(
'
new_password
'
))
{
if
(
value
&&
value
!==
form
.
getFieldValue
(
'
new_password
'
))
{
callback
(
messages
[
'
Incorrect-password.2
'
]);
callback
(
messages
[
'
Incorrect-password.2
'
]);
...
@@ -72,15 +72,15 @@ class EmailForm extends React.Component {
...
@@ -72,15 +72,15 @@ class EmailForm extends React.Component {
checkConfirm
=
(
rule
,
value
,
callback
)
=>
{
checkConfirm
=
(
rule
,
value
,
callback
)
=>
{
const
form
=
this
.
props
.
form
;
const
form
=
this
.
props
.
form
;
if
(
value
)
{
if
(
value
)
{
form
.
validateFields
([
'
confirm
'
],
{
force
:
true
});
form
.
validateFields
([
'
confirm
'
],
{
force
:
true
});
}
}
callback
();
callback
();
};
};
render
()
{
render
()
{
const
{
form
,
dispatch
,
user
,
checkUsername
,
isUserNameExists
,
messages
}
=
this
.
props
;
const
{
form
,
dispatch
,
user
,
checkUsername
,
isUserNameExists
,
messages
}
=
this
.
props
;
const
{
getFieldDecorator
}
=
form
;
const
{
getFieldDecorator
}
=
form
;
const
{
id
,
username
}
=
user
;
const
{
id
,
username
}
=
user
;
const
logoutNowText
=
this
.
props
.
messages
.
LogoutNow
;
const
logoutNowText
=
this
.
props
.
messages
.
LogoutNow
;
const
loggingOutInText
=
this
.
props
.
messages
.
LoggingOutIn
;
const
loggingOutInText
=
this
.
props
.
messages
.
LoggingOutIn
;
const
secondsText
=
this
.
props
.
messages
.
Seconds
;
const
secondsText
=
this
.
props
.
messages
.
Seconds
;
...
@@ -99,7 +99,7 @@ class EmailForm extends React.Component {
...
@@ -99,7 +99,7 @@ class EmailForm extends React.Component {
},
},
input
:
{
input
:
{
placeholder
:
messages
.
username
,
placeholder
:
messages
.
username
,
onBlur
:
()
=>
dispatch
({
type
:
'
auth/checkUsername
'
,
payload
:
{...
form
.
getFieldsValue
(),
user_id
:
id
}
}),
onBlur
:
()
=>
dispatch
({
type
:
'
auth/checkUsername
'
,
payload
:
{
...
form
.
getFieldsValue
(),
user_id
:
id
}
}),
},
},
};
};
...
@@ -122,16 +122,16 @@ class EmailForm extends React.Component {
...
@@ -122,16 +122,16 @@ class EmailForm extends React.Component {
type
:
'
password
'
,
type
:
'
password
'
,
},
},
};
};
const
{
inCountdown
,
countdown
}
=
this
.
state
;
const
{
inCountdown
,
countdown
}
=
this
.
state
;
return
(
return
(
<
div
>
<
div
>
{
inCountdown
?
(
{
inCountdown
?
(
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
alignItems
:
'
center
'
,
height
:
'
100vh
'
}}
>
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
alignItems
:
'
center
'
,
height
:
'
100vh
'
}}
>
<
div
style
=
{{
flex
:
9
/
10
,
textAlign
:
'
center
'
}}
>
<
div
style
=
{{
flex
:
9
/
10
,
textAlign
:
'
center
'
}}
>
<
h3
>
{
ChangeSuccessText
}
<
/h3
>
<
h3
>
{
ChangeSuccessText
}
<
/h3
>
<
h3
>
<
h3
>
{
loggingOutInText
}
{
loggingOutInText
}
<
span
style
=
{{
color
:
'
#4da9ee
'
,
fontSize
:
'
2em
'
}}
>&
nbsp
;{
`
${
countdown
}
`
}
<
/span
>
<
span
style
=
{{
color
:
'
#4da9ee
'
,
fontSize
:
'
2em
'
}}
>&
nbsp
;{
`
${
countdown
}
`
}
<
/span
>
<
span
>&
nbsp
;{
secondsText
}
<
/span
>
<
span
>&
nbsp
;{
secondsText
}
<
/span
>
<
/h3
>
<
/h3
>
<
br
/>
<
br
/>
...
@@ -143,17 +143,17 @@ class EmailForm extends React.Component {
...
@@ -143,17 +143,17 @@ class EmailForm extends React.Component {
)
:
(
)
:
(
<
Form
onSubmit
=
{
this
.
onSubmit
}
>
<
Form
onSubmit
=
{
this
.
onSubmit
}
>
<
FormItem
{...
usernameProps
.
fromItem
}
>
<
FormItem
{...
usernameProps
.
fromItem
}
>
{
getFieldDecorator
(
'
username
'
,
{
...
usernameProps
.
decorator
})(
{
getFieldDecorator
(
'
username
'
,
{
...
usernameProps
.
decorator
})(
<
Input
{...
usernameProps
.
input
}
disabled
/>
,
<
Input
{...
usernameProps
.
input
}
disabled
/>
,
)}
)}
{
{
<
div
class
=
"
alert alert-warning
"
role
=
"
alert
"
>
{
temporaryPromptText
}
<
/div
>
<
div
class
Name
=
"
alert alert-warning
"
role
=
"
alert
"
>
{
temporaryPromptText
}
<
/div
>
}
}
<
/FormItem
>
<
/FormItem
>
<
FormItem
{...
passwordProps
.
fromItem
}
>
<
FormItem
{...
passwordProps
.
fromItem
}
>
{
getFieldDecorator
(
'
password
'
,
{
...
passwordProps
.
decorator
})(
{
getFieldDecorator
(
'
password
'
,
{
...
passwordProps
.
decorator
})(
<
Input
{...
passwordProps
.
input
}
/>
,
<
Input
{...
passwordProps
.
input
}
/>
,
)}
)}
<
/FormItem
>
<
/FormItem
>
...
@@ -170,9 +170,9 @@ class EmailForm extends React.Component {
...
@@ -170,9 +170,9 @@ class EmailForm extends React.Component {
function
mapStateToProps
(
state
)
{
function
mapStateToProps
(
state
)
{
const
{
const
{
user
:
{
user
},
user
:
{
user
},
auth
:
{
isUserNameExists
,
checkUsername
},
auth
:
{
isUserNameExists
,
checkUsername
},
common
:
{
messages
},
common
:
{
messages
},
}
=
state
;
}
=
state
;
return
{
return
{
user
,
user
,
...
...
src/routes/Profiles.js
View file @
e842f96b
...
@@ -107,7 +107,7 @@ class Profiles extends React.Component {
...
@@ -107,7 +107,7 @@ class Profiles extends React.Component {
<
Form
onSubmit
=
{
this
.
onUpdateSubmit
}
>
<
Form
onSubmit
=
{
this
.
onUpdateSubmit
}
>
<
FormItem
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
FormItem
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
}}
>
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
}}
>
<
Cropper
<
Cropper
ref
=
{(
cropper
)
=>
{
ref
=
{(
cropper
)
=>
{
this
.
cropper
=
cropper
;
this
.
cropper
=
cropper
;
...
@@ -124,12 +124,12 @@ class Profiles extends React.Component {
...
@@ -124,12 +124,12 @@ class Profiles extends React.Component {
style
=
{{
height
:
'
300px
'
,
width
:
'
300px
'
,
display
:
!
isUpload
?
'
block
'
:
'
none
'
}}
style
=
{{
height
:
'
300px
'
,
width
:
'
300px
'
,
display
:
!
isUpload
?
'
block
'
:
'
none
'
}}
src
=
{
avatar
||
imageUrl
||
defaultAvatar
}
src
=
{
avatar
||
imageUrl
||
defaultAvatar
}
/
>
/
>
<
Button
type
=
"
primary
"
onClick
=
{
this
.
handleUpload
}
style
=
{{
display
:
isUpload
?
'
inline-block
'
:
'
none
'
,
marginTop
:
'
2em
'
}}
>
<
Button
type
=
"
primary
"
onClick
=
{
this
.
handleUpload
}
style
=
{{
display
:
isUpload
?
'
inline-block
'
:
'
none
'
,
marginTop
:
'
2em
'
}}
>
<
Icon
type
=
"
check
"
/>
<
Format
id
=
"
Upload-Avatar
"
/>
<
Icon
type
=
"
check
"
/>
<
Format
id
=
"
Upload-Avatar
"
/>
<
/Button
>
<
/Button
>
<
Button
type
=
"
default
"
style
=
{{
marginTop
:
'
2em
'
}}
>
<
Button
type
=
"
default
"
style
=
{{
marginTop
:
'
2em
'
}}
>
<
label
style
=
{{
display
:
'
flex
'
,
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
}}
>
<
label
style
=
{{
display
:
'
flex
'
,
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
}}
>
<
Icon
type
=
"
plus
"
style
=
{{
marginRight
:
'
0.5em
'
}}
/
>
<
Icon
type
=
"
plus
"
style
=
{{
marginRight
:
'
0.5em
'
}}
/
>
{(
!
isUpload
)
&&
<
Format
id
=
"
Change-Avatar
"
/>
}
{(
!
isUpload
)
&&
<
Format
id
=
"
Change-Avatar
"
/>
}
{
isUpload
&&
<
Format
id
=
"
Reselect-Avatar
"
/>
}
{
isUpload
&&
<
Format
id
=
"
Reselect-Avatar
"
/>
}
<
input
<
input
...
@@ -147,7 +147,7 @@ class Profiles extends React.Component {
...
@@ -147,7 +147,7 @@ class Profiles extends React.Component {
<
Input
{...
nameProps
.
input
}
/>
,
<
Input
{...
nameProps
.
input
}
/>
,
)}
)}
{
{
<
div
class
=
"
alert alert-warning
"
role
=
"
alert
"
><
Format
id
=
"
Nickname-Hint
"
/><
/div
>
<
div
class
Name
=
"
alert alert-warning
"
role
=
"
alert
"
><
Format
id
=
"
Nickname-Hint
"
/><
/div
>
}
}
<
/FormItem
>
<
/FormItem
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment