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 @@
...
@@ -55,7 +55,7 @@
"Please input your account!"
:
"Please input your email or username!"
,
"Please input your account!"
:
"Please input your email or username!"
,
"Please-input-your-Password!"
:
"Please input your Password!"
,
"Please-input-your-Password!"
:
"Please input your Password!"
,
"verify-email"
:
"Verify
e
mail"
,
"verify-email"
:
"Verify
E
mail"
,
"account-info"
:
"Account Info"
,
"account-info"
:
"Account Info"
,
"reset-username"
:
"Reset Username"
,
"reset-username"
:
"Reset Username"
,
"reset-email"
:
"Reset Email"
,
"reset-email"
:
"Reset Email"
,
...
...
src/models/auth.js
View file @
618b460f
...
@@ -241,11 +241,5 @@ export default {
...
@@ -241,11 +241,5 @@ export default {
},
},
},
},
subscriptions
:
{
subscriptions
:
{
setup
({
dispatch
,
history
})
{
return
history
.
listen
(({
pathname
,
query
})
=>
{
})
}
}
}
};
};
src/models/user.js
View file @
618b460f
...
@@ -75,6 +75,11 @@ export default {
...
@@ -75,6 +75,11 @@ export default {
return
{
return
{
...
state
,
...
action
.
payload
...
state
,
...
action
.
payload
}
}
},
getAuthUserSuccess
(
state
,
action
)
{
return
{
...
state
,
...
action
.
payload
}
}
}
},
},
effects
:
{
effects
:
{
...
@@ -104,33 +109,41 @@ export default {
...
@@ -104,33 +109,41 @@ export default {
}
}
}
}
},
},
*
preLogin
({
payload
},
{
call
,
put
})
{
*
getAuthUser
({
payload
},
{
call
,
put
,
select
})
{
const
{
token
}
=
payload
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
)
{
if
(
!
token
)
{
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
}
}
try
{
try
{
let
{
data
}
=
yield
call
(
getAuthUser
,
{
token
})
if
(
user
[
"
id
"
])
{
if
(
data
)
{
yield
put
({
type
:
'
preLoginSuccess
'
,
payload
:
{
user
:
data
,
token
}})
if
(
data
)
{
if
(
handleSSO
(
user
)){
if
(
handleSSO
(
user
)){
return
return
}
}
if
(
data
.
active
)
{
if
(
user
.
active
)
{
yield
put
(
routerRedux
.
replace
(
"
/profiles
"
))
yield
put
(
routerRedux
.
replace
(
"
/profiles
"
))
}
else
{
}
else
{
yield
put
(
routerRedux
.
replace
(
"
/verify
"
))
yield
put
(
routerRedux
.
replace
(
"
/verify
"
))
}
}
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
yield
put
(
routerRedux
.
replace
(
"
/signin
"
))
message
.
error
(
error
.
message
)
}
}
},
},
*
updateProfile
({
payload
},
{
call
,
put
,
select
})
{
*
updateProfile
({
payload
},
{
call
,
put
,
select
})
{
...
@@ -188,14 +201,13 @@ export default {
...
@@ -188,14 +201,13 @@ export default {
setup
({
dispatch
,
history
})
{
setup
({
dispatch
,
history
})
{
let
token
=
localStorage
.
getItem
(
"
token
"
)
let
token
=
localStorage
.
getItem
(
"
token
"
)
return
history
.
listen
(({
pathname
,
query
})
=>
{
if
(
token
)
{
dispatch
({
type
:
'
getAuthUser
'
,
payload
:
{
token
}})
if
(
pathname
==
'
/
'
||
pathname
==
'
profiles
'
)
{
}
dispatch
({
type
:
'
preLogin
'
,
payload
:
{
token
}
})
}
if
(
pathname
==
'
profiles
'
&&
!
token
)
{
history
.
listen
(({
pathname
,
query
})
=>
{
history
.
push
(
"
/signin
"
)
if
(
pathname
==
'
/
'
)
{
dispatch
({
type
:
'
preLogin
'
})
}
}
})
})
}
}
...
...
src/router.js
View file @
618b460f
...
@@ -22,7 +22,6 @@ function RouterConfig({ history }) {
...
@@ -22,7 +22,6 @@ function RouterConfig({ history }) {
return
(
return
(
<
Router
history
=
{
history
}
>
<
Router
history
=
{
history
}
>
<
Route
path
=
"
/
"
component
=
{
Index
}
>
<
Route
path
=
"
/
"
component
=
{
Index
}
>
<
Redirect
from
=
"
/home
"
to
=
"
/profiles
"
/>
<
Route
path
=
"
/signin
"
component
=
{
Login
}
/
>
<
Route
path
=
"
/signin
"
component
=
{
Login
}
/
>
<
Route
path
=
"
/forgot
"
component
=
{
Forgot
}
/
>
<
Route
path
=
"
/forgot
"
component
=
{
Forgot
}
/
>
<
Route
path
=
"
/signup
"
component
=
{
Register
}
/
>
<
Route
path
=
"
/signup
"
component
=
{
Register
}
/
>
...
...
src/routes/Index.js
View file @
618b460f
...
@@ -129,7 +129,7 @@ function Index({ dispatch, children, messages }) {
...
@@ -129,7 +129,7 @@ function Index({ dispatch, children, messages }) {
<
DocumentTitle
title
=
{
messages
[
'
title
'
]
||
'
Moe Cube
'
}
/>
<
DocumentTitle
title
=
{
messages
[
'
title
'
]
||
'
Moe Cube
'
}
/>
<
Header
style
=
{{
display
:
'
flex
'
,
alignItems
:
'
center
'
}}
>
<
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
'
}}
/>
<
img
src
=
{
logo
}
style
=
{{
width
:
'
140px
'
,
height
:
'
44px
'
}}
/>
<
/Link
>
<
/Link
>
...
@@ -139,7 +139,7 @@ function Index({ dispatch, children, messages }) {
...
@@ -139,7 +139,7 @@ function Index({ dispatch, children, messages }) {
defaultSelectedKeys
=
{[
'
1
'
]}
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
}}
>
style
=
{{
lineHeight
:
'
64px
'
}}
>
<
Menu
.
Item
key
=
"
1
"
>
<
Menu
.
Item
key
=
"
1
"
>
<
Link
to
=
"
/
home
"
>
<
Link
to
=
"
/
"
>
Home
Home
<
/Link
>
<
/Link
>
<
/Menu.Item
>
<
/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