Updated create component HTML to change form margin, and refactored profile component to simplify secret key handling and remove password dialog.

This commit is contained in:
Milad Raeisi
2024-11-24 00:38:13 +04:00
parent 489456ca02
commit ac0c49e14e
2 changed files with 3 additions and 31 deletions

View File

@@ -77,7 +77,7 @@
<!-- Register form -->
<form
class="mt-8"
class="mt-2"
[formGroup]="registerForm"
#registerNgForm="ngForm"
>

View File

@@ -127,43 +127,15 @@ export class SettingsProfileComponent implements OnInit {
this.content = JSON.stringify(profileData);
if (this._signerService.isUsingSecretKey()) {
const storedPassword = this._signerService.getPassword();
if (storedPassword) {
try {
const privateKey =
await this._signerService.getSecretKey(storedPassword);
await this._signerService.getDecryptedSecretKey();
this.signEvent(privateKey);
} catch (error) {
console.error(error);
}
} else {
const dialogRef = this._dialog.open(PasswordDialogComponent, {
width: '300px',
disableClose: true,
});
dialogRef.afterClosed().subscribe(async (result) => {
if (result && result.password) {
try {
const privateKey =
await this._signerService.getSecretKey(
result.password
);
this.signEvent(privateKey);
if (result.duration != 0) {
this._signerService.savePassword(
result.password,
result.duration
);
}
} catch (error) {
console.error(error);
}
} else {
console.error('Password not provided');
}
});
}
} else if (this._signerService.isUsingExtension()) {
const unsignedEvent: UnsignedEvent =
this._signerService.getUnsignedEvent(0, [], this.content);