cleanup login function
This commit is contained in:
parent
7103f15236
commit
c1a1a83d85
@ -25,7 +25,7 @@ export class AuthService {
|
|||||||
this.mutableKeyStore = new MutablePgpKeyStore()
|
this.mutableKeyStore = new MutablePgpKeyStore()
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(): void {
|
async init(): Promise<void> {
|
||||||
this.mutableKeyStore.loadKeyring();
|
this.mutableKeyStore.loadKeyring();
|
||||||
// TODO setting these together shoulds be atomic
|
// TODO setting these together shoulds be atomic
|
||||||
if (sessionStorage.getItem(btoa('CICADA_SESSION_TOKEN'))) {
|
if (sessionStorage.getItem(btoa('CICADA_SESSION_TOKEN'))) {
|
||||||
@ -97,36 +97,6 @@ export class AuthService {
|
|||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
login(): boolean {
|
|
||||||
// TODO check if we have privatekey
|
|
||||||
// Send us to home if we have a private key
|
|
||||||
// talk to meta somehow
|
|
||||||
// in the error interceptor if 401/403 handle it
|
|
||||||
// if 200 go /home
|
|
||||||
if (!this.getPrivateKey()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
// if (this.sessionToken !== undefined) {
|
|
||||||
// try {
|
|
||||||
// //this.getWithToken();
|
|
||||||
// return true;
|
|
||||||
// } catch (e) {
|
|
||||||
// this.loggingService.sendErrorLevelMessage('Login token failed', this, {error: e});
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// try {
|
|
||||||
// // this.getChallenge();
|
|
||||||
// return true
|
|
||||||
// } catch (e) {
|
|
||||||
// this.loggingService.sendErrorLevelMessage('Login challenge failed', this, {error: e});
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async loginResponse(o): Promise<any> {
|
async loginResponse(o): Promise<any> {
|
||||||
return new Promise(async(resolve, reject) => {
|
return new Promise(async(resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
|
@ -46,8 +46,12 @@ export class AuthComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
login(): void {
|
login(): void {
|
||||||
const loginStatus = this.authService.login();
|
// TODO check if we have privatekey
|
||||||
if (loginStatus) {
|
// Send us to home if we have a private key
|
||||||
|
// talk to meta somehow
|
||||||
|
// in the error interceptor if 401/403 handle it
|
||||||
|
// if 200 go /home
|
||||||
|
if (this.authService.getPrivateKey()) {
|
||||||
this.router.navigate(['/home']);
|
this.router.navigate(['/home']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user