|
@@ -15,29 +15,28 @@ const Model = {
|
15
|
15
|
type: 'changeLoginStatus',
|
16
|
16
|
payload: response,
|
17
|
17
|
}); // Login successfully
|
|
18
|
+
|
|
19
|
+ const urlParams = new URL(window.location.href);
|
|
20
|
+ const params = getPageQuery();
|
|
21
|
+ let { redirect } = params;
|
18
|
22
|
|
19
|
|
- if (response.status === 'ok') {
|
20
|
|
- const urlParams = new URL(window.location.href);
|
21
|
|
- const params = getPageQuery();
|
22
|
|
- let { redirect } = params;
|
|
23
|
+ if (redirect) {
|
|
24
|
+ const redirectUrlParams = new URL(redirect);
|
23
|
25
|
|
24
|
|
- if (redirect) {
|
25
|
|
- const redirectUrlParams = new URL(redirect);
|
|
26
|
+ if (redirectUrlParams.origin === urlParams.origin) {
|
|
27
|
+ redirect = redirect.substr(urlParams.origin.length);
|
26
|
28
|
|
27
|
|
- if (redirectUrlParams.origin === urlParams.origin) {
|
28
|
|
- redirect = redirect.substr(urlParams.origin.length);
|
29
|
|
-
|
30
|
|
- if (redirect.match(/^\/.*#/)) {
|
31
|
|
- redirect = redirect.substr(redirect.indexOf('#') + 1);
|
32
|
|
- }
|
33
|
|
- } else {
|
34
|
|
- window.location.href = redirect;
|
35
|
|
- return;
|
|
29
|
+ if (redirect.match(/^\/.*#/)) {
|
|
30
|
+ redirect = redirect.substr(redirect.indexOf('#') + 1);
|
36
|
31
|
}
|
|
32
|
+ } else {
|
|
33
|
+ window.location.href = redirect;
|
|
34
|
+ return;
|
37
|
35
|
}
|
38
|
|
-
|
39
|
|
- yield put(routerRedux.replace(redirect || '/'));
|
40
|
36
|
}
|
|
37
|
+
|
|
38
|
+ yield put(routerRedux.replace(redirect || '/'));
|
|
39
|
+
|
41
|
40
|
},
|
42
|
41
|
|
43
|
42
|
*getCaptcha({ payload }, { call }) {
|
|
@@ -61,8 +60,8 @@ const Model = {
|
61
|
60
|
},
|
62
|
61
|
reducers: {
|
63
|
62
|
changeLoginStatus(state, { payload }) {
|
64
|
|
- setAuthority(payload.currentAuthority);
|
65
|
|
- return { ...state, status: payload.status, type: payload.type };
|
|
63
|
+ setAuthority('admin');
|
|
64
|
+ return { ...state, status: 'ok', type: payload.type };
|
66
|
65
|
},
|
67
|
66
|
},
|
68
|
67
|
};
|