Lint code.

This commit is contained in:
Spencer Ofwiti 2021-06-07 18:49:15 +03:00
parent 159cedc86e
commit 8e96b070a5
3 changed files with 36 additions and 18 deletions

View File

@ -102,8 +102,11 @@ export class AuthService {
await this.loginResponse(o, password);
return true;
} catch (error) {
this.loggingService.sendErrorLevelMessage(`Login challenge failed: Error ${error.status} - ${error.statusText}`,
this, {error});
this.loggingService.sendErrorLevelMessage(
`Login challenge failed: Error ${error.status} - ${error.statusText}`,
this,
{ error }
);
}
return false;
}
@ -114,8 +117,11 @@ export class AuthService {
this.getWithToken();
return true;
} catch (error) {
this.loggingService.sendErrorLevelMessage(`Login token failed: Error ${error.status} - ${error.statusText}`,
this, {error});
this.loggingService.sendErrorLevelMessage(
`Login token failed: Error ${error.status} - ${error.statusText}`,
this,
{ error }
);
}
}
return false;
@ -162,9 +168,11 @@ export class AuthService {
if (!isValidKeyCheck) {
throw Error('The private key is invalid');
}
const isEncryptedKeyCheck = await this.mutableKeyStore.isEncryptedPrivateKey(privateKeyArmored);
const isEncryptedKeyCheck = await this.mutableKeyStore.isEncryptedPrivateKey(
privateKeyArmored
);
if (!isEncryptedKeyCheck) {
throw Error('The private key doesn\'t have a password!');
throw Error('The private key does not have a password!');
}
const key = await this.mutableKeyStore.importPrivateKey(privateKeyArmored);
localStorage.setItem(btoa('CICADA_PRIVATE_KEY'), privateKeyArmored);

View File

@ -23,8 +23,8 @@ export class AuthComponent implements OnInit {
private authService: AuthService,
private formBuilder: FormBuilder,
private router: Router,
private cdr: ChangeDetectorRef,
) { }
private cdr: ChangeDetectorRef
) {}
async ngOnInit(): Promise<void> {
this.keyForm = this.formBuilder.group({
@ -44,8 +44,12 @@ export class AuthComponent implements OnInit {
}
}
get keyFormStub(): any { return this.keyForm.controls; }
get passwordFormStub(): any { return this.passwordForm.controls; }
get keyFormStub(): any {
return this.keyForm.controls;
}
get passwordFormStub(): any {
return this.passwordForm.controls;
}
async onSubmit(): Promise<void> {
this.keyFormSubmitted = true;
@ -66,10 +70,14 @@ export class AuthComponent implements OnInit {
async onPasswordInput(): Promise<void> {
this.passwordFormSubmitted = true;
if (this.passwordForm.invalid) { return; }
if (this.passwordForm.invalid) {
return;
}
this.passwordFormLoading = true;
const passwordLogin = await this.authService.passwordLogin(this.passwordFormStub.password.value);
const passwordLogin = await this.authService.passwordLogin(
this.passwordFormStub.password.value
);
if (passwordLogin) {
this.loginView();
}
@ -95,7 +103,9 @@ export class AuthComponent implements OnInit {
passwordInput(): void {
this.authService.sessionToken = undefined;
this.switchWindows(false, true, false);
this.setPasswordState('Enter Password to log in with PGP key ' + this.authService.mutableKeyStore.getPrivateKeyId());
this.setPasswordState(
'Enter Password to log in with PGP key ' + this.authService.mutableKeyStore.getPrivateKeyId()
);
}
loginView(): void {