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
618b460f
Commit
618b460f
authored
Apr 05, 2017
by
2breakegg
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
f7bfe813
08389f5c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
30 deletions
+35
-30
i18n.json
i18n.json
+1
-1
src/models/auth.js
src/models/auth.js
+0
-6
src/models/user.js
src/models/user.js
+32
-20
src/router.js
src/router.js
+0
-1
src/routes/Index.js
src/routes/Index.js
+2
-2
No files found.
i18n.json
View file @
618b460f
...
...
@@ -55,7 +55,7 @@
"Please input your account!"
:
"Please input your email or username!"
,
"Please-input-your-Password!"
:
"Please input your Password!"
,
"verify-email"
:
"Verify
e
mail"
,
"verify-email"
:
"Verify
E
mail"
,
"account-info"
:
"Account Info"
,
"reset-username"
:
"Reset Username"
,
"reset-email"
:
"Reset Email"
,
...
...
src/models/auth.js
View file @
618b460f
...
...
@@ -241,11 +241,5 @@ export default {
},
},
subscriptions
:
{
setup
({
dispatch
,
history
})
{
return
history
.
listen
(({
pathname
,
query
})
=>
{
})
}
}
};
src/models/user.js
View file @
618b460f
...
...
@@ -75,6 +75,11 @@ export default {
return
{
...
state
,
...
action
.
payload
}
},
getAuthUserSuccess
(
state
,
action
)
{
return
{
...
state
,
...
action
.
payload
}
}
},
effects
:
{
...
...
@@ -104,33 +109,41 @@ export default {
}
}
},
*
preLogin
({
payload
},
{
call
,
put
})
{
const
{
token
}
=
payload
*
getAuthUser
({
payload
},
{
call
,
put
,
select
})
{
const
{
token
}
=
payload
try
{
let
{
data
}
=
yield
call
(
getAuthUser
,
{
token
})
if
(
data
)
{
yield
put
({
type
:
'
getAuthUserSuccess
'
,
payload
:
{
user
:
data
,
token
}})
yield
put
({
type
:
'
preLogin
'
})
}
}
catch
(
error
)
{
message
.
error
(
error
.
message
)
}
},
*
preLogin
({
payload
},
{
call
,
put
,
select
})
{
const
{
token
,
user
}
=
yield
select
(
state
=>
state
.
user
)
if
(
!
token
)
{
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
}
try
{
let
{
data
}
=
yield
call
(
getAuthUser
,
{
token
})
if
(
data
)
{
yield
put
({
type
:
'
preLoginSuccess
'
,
payload
:
{
user
:
data
,
token
}})
if
(
data
)
{
if
(
user
[
"
id
"
])
{
if
(
handleSSO
(
user
)){
return
}
if
(
data
.
active
)
{
yield
put
(
routerRedux
.
replace
(
"
/profiles
"
))
if
(
user
.
active
)
{
yield
put
(
routerRedux
.
replace
(
"
/profiles
"
))
}
else
{
yield
put
(
routerRedux
.
replace
(
"
/verify
"
))
}
}
}
}
}
catch
(
error
)
{
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
message
.
error
(
error
.
message
)
}
},
*
updateProfile
({
payload
},
{
call
,
put
,
select
})
{
...
...
@@ -188,14 +201,13 @@ export default {
setup
({
dispatch
,
history
})
{
let
token
=
localStorage
.
getItem
(
"
token
"
)
return
history
.
listen
(({
pathname
,
query
})
=>
{
if
(
pathname
==
'
/
'
||
pathname
==
'
profiles
'
)
{
dispatch
({
type
:
'
preLogin
'
,
payload
:
{
token
}
})
}
if
(
token
)
{
dispatch
({
type
:
'
getAuthUser
'
,
payload
:
{
token
}})
}
if
(
pathname
==
'
profiles
'
&&
!
token
)
{
history
.
push
(
"
/signin
"
)
history
.
listen
(({
pathname
,
query
})
=>
{
if
(
pathname
==
'
/
'
)
{
dispatch
({
type
:
'
preLogin
'
})
}
})
}
...
...
src/router.js
View file @
618b460f
...
...
@@ -22,7 +22,6 @@ function RouterConfig({ history }) {
return
(
<
Router
history
=
{
history
}
>
<
Route
path
=
"
/
"
component
=
{
Index
}
>
<
Redirect
from
=
"
/home
"
to
=
"
/profiles
"
/>
<
Route
path
=
"
/signin
"
component
=
{
Login
}
/
>
<
Route
path
=
"
/forgot
"
component
=
{
Forgot
}
/
>
<
Route
path
=
"
/signup
"
component
=
{
Register
}
/
>
...
...
src/routes/Index.js
View file @
618b460f
...
...
@@ -129,7 +129,7 @@ function Index({ dispatch, children, messages }) {
<
DocumentTitle
title
=
{
messages
[
'
title
'
]
||
'
Moe Cube
'
}
/>
<
Header
style
=
{{
display
:
'
flex
'
,
alignItems
:
'
center
'
}}
>
<
Link
to
=
"
/
home
"
style
=
{{
marginTop
:
'
20px
'
}}
>
<
Link
to
=
"
/
"
style
=
{{
marginTop
:
'
20px
'
}}
>
<
img
src
=
{
logo
}
style
=
{{
width
:
'
140px
'
,
height
:
'
44px
'
}}
/>
<
/Link
>
...
...
@@ -139,7 +139,7 @@ function Index({ dispatch, children, messages }) {
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
}}
>
<
Menu
.
Item
key
=
"
1
"
>
<
Link
to
=
"
/
home
"
>
<
Link
to
=
"
/
"
>
Home
<
/Link
>
<
/Menu.Item
>
...
...
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