|
@@ -18,23 +18,21 @@ export function useSso() {
|
|
|
const ticket = getUrlParam('ticket');
|
|
|
if (!token) {
|
|
|
if (ticket) {
|
|
|
- await validateCasLogin({
|
|
|
- ticket: ticket,
|
|
|
- service: locationUrl,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- redirect = false;
|
|
|
- const userStore = useUserStore();
|
|
|
- userStore.setToken(res.token);
|
|
|
- return userStore.afterLoginAction(true, {});
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- redirect = true;
|
|
|
- window.location.href = globSetting.casBaseUrl + '/login?service=' + encodeURIComponent(locationUrl);
|
|
|
+ try {
|
|
|
+ const res = await validateCasLogin({
|
|
|
+ ticket: ticket,
|
|
|
+ service: locationUrl,
|
|
|
});
|
|
|
+ const userStore = useUserStore();
|
|
|
+ userStore.setToken(res.token);
|
|
|
+ redirect = true;
|
|
|
+ await userStore.afterLoginAction(true, {});
|
|
|
+ } catch (e) {
|
|
|
+ redirect = true;
|
|
|
+ window.location.href = globSetting.casBaseUrl + '/login?service=' + encodeURIComponent(locationUrl);
|
|
|
+ }
|
|
|
} else {
|
|
|
if (window.location.search == '?type=noCas') {
|
|
|
- redirect = false;
|
|
|
} else {
|
|
|
window.location.href = globSetting.casBaseUrl + '/login?service=' + encodeURIComponent(locationUrl);
|
|
|
redirect = true;
|