|
|
|
@ -43,23 +43,25 @@ export class LoginComponent implements OnInit {
|
|
|
|
|
this.message.create('error', `请输入账号密码`); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (!this.selectedRole) { |
|
|
|
|
this.message.create('error', `请选择登录角色`); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
// if (!this.selectedRole) {
|
|
|
|
|
// this.message.create('error', `请选择登录角色`);
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
this.http.post('/api/TokenAuth/Authenticate', { |
|
|
|
|
userNameOrEmailAddress: this.validateForm.value.userName, |
|
|
|
|
password: this.validateForm.value.password |
|
|
|
|
}).subscribe( |
|
|
|
|
(data: any) => { |
|
|
|
|
this.message.create('success', `登陆成功`); |
|
|
|
|
|
|
|
|
|
sessionStorage.setItem("token", data.result.accessToken); |
|
|
|
|
this.cookieService.set("token", data.result.accessToken, null, '/'); |
|
|
|
|
this.cookieService.set("refreshToken", data.result.encryptedAccessToken, null, '/'); |
|
|
|
|
this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data:any) => { |
|
|
|
|
sessionStorage.setItem('userdata',JSON.stringify(data.result.user)) |
|
|
|
|
this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => { |
|
|
|
|
sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) |
|
|
|
|
this.message.create('success', `登陆成功`); |
|
|
|
|
this.router.navigate(['/home/plan']) |
|
|
|
|
}) |
|
|
|
|
this.router.navigate(['/home/plan']) |
|
|
|
|
|
|
|
|
|
//调用服务中的function刷新token
|
|
|
|
|
// this.token.startUp()
|
|
|
|
|
}, |
|
|
|
|