Commit b8e21d78 authored by 神楽坂玲奈's avatar 神楽坂玲奈

logout

parent 960d3fb7
......@@ -19,7 +19,7 @@ export class AuthGuard implements CanActivateChild {
this.login.callback(token);
return true;
} else {
this.login.login();
location.replace(this.login.login());
return false;
}
......
......@@ -19,6 +19,7 @@
<md-icon>add</md-icon>
</button>
<md-menu #menu="mdMenu">
<a [href]="login.logout()" md-menu-item>切换用户</a>
<button md-menu-item>大厅版本 {{version}}</button>
</md-menu>
</md-toolbar>
......
......@@ -41,7 +41,19 @@ export class LoginService {
// );
// console.log(Buffer.from(new TextDecoder().decode(sign)).toString('hex'));
// params.set('sig', crypto.createHmac('sha256', 'zsZv6LXHDwwtUAGa').update(payload).digest('hex'));
return location.replace(url.toString());
return url.toString();
}
logout() {
let params = new URLSearchParams();
params.set('return_sso_url', location.href);
let payload = Buffer.from(params.toString()).toString('base64');
let url = new URL('https://accounts.moecube.com/signin');
params = url['searchParams'];
params.set('sso', payload);
return url.toString();
}
callback(token: string) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment