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
224d863e
Commit
224d863e
authored
Dec 27, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix redirect on error
parent
e585632f
Pipeline
#42171
failed with stages
in 4 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
17 deletions
+83
-17
src/components/EmailForm.js
src/components/EmailForm.js
+13
-4
src/components/PasswordForm.js
src/components/PasswordForm.js
+15
-7
src/components/UserNameForm.js
src/components/UserNameForm.js
+13
-3
src/models/user.js
src/models/user.js
+42
-3
No files found.
src/components/EmailForm.js
View file @
224d863e
...
@@ -29,12 +29,22 @@ class EmailForm extends React.Component {
...
@@ -29,12 +29,22 @@ class EmailForm extends React.Component {
const
{
email
,
password
}
=
values
;
const
{
email
,
password
}
=
values
;
dispatch
({
type
:
'
user/updateEmail
'
,
payload
:
{
email
,
password
,
user_id
:
id
}
});
dispatch
({
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
type
:
'
user/updateEmail
'
,
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
payload
:
{
email
,
password
,
user_id
:
id
,
onSuccess
:
this
.
startCountdown
,
},
});
}
}
});
});
};
};
startCountdown
=
()
=>
{
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
};
handleCountdown
=
()
=>
{
handleCountdown
=
()
=>
{
// 倒计时减1
// 倒计时减1
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
...
@@ -170,4 +180,3 @@ function mapStateToProps(state) {
...
@@ -170,4 +180,3 @@ function mapStateToProps(state) {
const
WrapperEmailForm
=
Form
.
create
()(
EmailForm
);
const
WrapperEmailForm
=
Form
.
create
()(
EmailForm
);
export
default
connect
(
mapStateToProps
)(
WrapperEmailForm
);
export
default
connect
(
mapStateToProps
)(
WrapperEmailForm
);
src/components/PasswordForm.js
View file @
224d863e
...
@@ -28,15 +28,24 @@ class EmailForm extends React.Component {
...
@@ -28,15 +28,24 @@ class EmailForm extends React.Component {
const
{
new_password
,
password
}
=
values
;
const
{
new_password
,
password
}
=
values
;
dispatch
({
type
:
'
user/updateAccount
'
,
payload
:
{
new_password
,
password
,
user_id
:
id
}
});
dispatch
({
type
:
'
user/updateAccount
'
,
// 设置倒计时状态为5秒
payload
:
{
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
new_password
,
// 启动倒计时
password
,
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
user_id
:
id
,
onSuccess
:
this
.
startCountdown
,
},
});
}
}
});
});
};
};
startCountdown
=
()
=>
{
// 设置倒计时状态为5秒
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
// 启动倒计时
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
};
handleCountdown
=
()
=>
{
handleCountdown
=
()
=>
{
// 倒计时减1
// 倒计时减1
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
...
@@ -202,4 +211,3 @@ function mapStateToProps(state) {
...
@@ -202,4 +211,3 @@ function mapStateToProps(state) {
const
WrapperEmailForm
=
Form
.
create
()(
EmailForm
);
const
WrapperEmailForm
=
Form
.
create
()(
EmailForm
);
export
default
connect
(
mapStateToProps
)(
WrapperEmailForm
);
export
default
connect
(
mapStateToProps
)(
WrapperEmailForm
);
src/components/UserNameForm.js
View file @
224d863e
...
@@ -29,12 +29,22 @@ class EmailForm extends React.Component {
...
@@ -29,12 +29,22 @@ class EmailForm extends React.Component {
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
({
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
type
:
'
user/updateAccount
'
,
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
payload
:
{
username
,
password
,
user_id
:
id
,
onSuccess
:
this
.
startCountdown
,
},
});
}
}
});
});
};
};
startCountdown
=
()
=>
{
this
.
setState
({
countdown
:
5
,
inCountdown
:
true
});
this
.
countdownTimer
=
setInterval
(
this
.
handleCountdown
,
1000
);
};
handleCountdown
=
()
=>
{
handleCountdown
=
()
=>
{
// 倒计时减1
// 倒计时减1
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
this
.
setState
(
prevState
=>
({
countdown
:
prevState
.
countdown
-
1
}));
...
...
src/models/user.js
View file @
224d863e
...
@@ -157,46 +157,85 @@ export default {
...
@@ -157,46 +157,85 @@ export default {
const
token
=
yield
select
(
state
=>
state
.
user
.
token
);
const
token
=
yield
select
(
state
=>
state
.
user
.
token
);
const
{
messages
}
=
yield
select
(
state
=>
state
.
common
);
const
{
messages
}
=
yield
select
(
state
=>
state
.
common
);
const
{
onSuccess
,
onError
,
...
restPayload
}
=
payload
||
{};
try
{
try
{
const
{
data
}
=
yield
call
(
updateProfile
,
{
...
p
ayload
,
token
});
const
{
data
}
=
yield
call
(
updateProfile
,
{
...
restP
ayload
,
token
});
if
(
data
)
{
if
(
data
)
{
yield
put
({
type
:
'
updateProfileSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
yield
put
({
type
:
'
updateProfileSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
message
.
info
(
messages
.
update_success
,
3
);
message
.
info
(
messages
.
update_success
,
3
);
if
(
onSuccess
)
{
onSuccess
(
data
);
}
return
true
;
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
yield
put
({
type
:
'
updateProfileFail
'
});
yield
put
({
type
:
'
updateProfileFail
'
});
message
.
error
(
error
.
message
,
3
);
message
.
error
(
error
.
message
,
3
);
if
(
onError
)
{
onError
(
error
);
}
return
false
;
}
if
(
onError
)
{
onError
(
new
Error
(
'
empty_response
'
));
}
}
return
false
;
},
},
*
updateEmail
({
payload
},
{
call
,
put
,
select
})
{
*
updateEmail
({
payload
},
{
call
,
put
,
select
})
{
const
{
messages
}
=
yield
select
(
state
=>
state
.
common
);
const
{
messages
}
=
yield
select
(
state
=>
state
.
common
);
const
{
onSuccess
,
onError
,
...
restPayload
}
=
payload
||
{};
try
{
try
{
const
token
=
yield
select
(
state
=>
state
.
user
.
token
);
const
token
=
yield
select
(
state
=>
state
.
user
.
token
);
const
{
data
}
=
yield
call
(
updateAccount
,
{
...
p
ayload
,
token
});
const
{
data
}
=
yield
call
(
updateAccount
,
{
...
restP
ayload
,
token
});
if
(
data
)
{
if
(
data
)
{
yield
put
({
type
:
'
updateAccountSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
yield
put
({
type
:
'
updateAccountSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
message
.
info
(
messages
[
'
A-verification-email-has-been-sent-to-you,please-check-the-mail-to-complete.
'
],
3
);
message
.
info
(
messages
[
'
A-verification-email-has-been-sent-to-you,please-check-the-mail-to-complete.
'
],
3
);
if
(
onSuccess
)
{
onSuccess
(
data
);
}
return
true
;
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
yield
put
({
type
:
'
updateAccountFail
'
});
yield
put
({
type
:
'
updateAccountFail
'
});
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
if
(
onError
)
{
onError
(
error
);
}
return
false
;
}
}
if
(
onError
)
{
onError
(
new
Error
(
'
empty_response
'
));
}
return
false
;
},
},
*
updateAccount
({
payload
},
{
call
,
put
,
select
})
{
*
updateAccount
({
payload
},
{
call
,
put
,
select
})
{
const
{
messages
}
=
yield
select
(
state
=>
state
.
common
);
const
{
messages
}
=
yield
select
(
state
=>
state
.
common
);
const
{
onSuccess
,
onError
,
...
restPayload
}
=
payload
||
{};
try
{
try
{
const
token
=
yield
select
(
state
=>
state
.
user
.
token
);
const
token
=
yield
select
(
state
=>
state
.
user
.
token
);
const
{
data
}
=
yield
call
(
updateAccount
,
{
...
p
ayload
,
token
});
const
{
data
}
=
yield
call
(
updateAccount
,
{
...
restP
ayload
,
token
});
if
(
data
)
{
if
(
data
)
{
yield
put
({
type
:
'
updateAccountSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
yield
put
({
type
:
'
updateAccountSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
message
.
info
(
messages
.
update_success
,
3
);
message
.
info
(
messages
.
update_success
,
3
);
if
(
onSuccess
)
{
onSuccess
(
data
);
}
return
true
;
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
yield
put
({
type
:
'
updateAccountFail
'
});
yield
put
({
type
:
'
updateAccountFail
'
});
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
if
(
onError
)
{
onError
(
error
);
}
return
false
;
}
if
(
onError
)
{
onError
(
new
Error
(
'
empty_response
'
));
}
}
return
false
;
},
},
},
},
subscriptions
:
{
subscriptions
:
{
...
...
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