Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

chore(frontend): enhance auth UI

johaven394aecbf2f03
diff --git a/frontend/src/app/auth/auth.component.html b/frontend/src/app/auth/auth.component.html
index 53953229..94b2b701 100644
--- a/frontend/src/app/auth/auth.component.html
+++ b/frontend/src/app/auth/auth.component.html
@@ -6,10 +6,10 @@
</div>
<div class="body">
@if (twoFaVerify) {
- <p class="fs-sm mb-3 {{hasError ? 'text-danger' : 'text-white-50'}}" l10nTranslate>{{ hasError || 'Two-Factor Authentication' }}</p>
+ <p class="fs-xs mb-3 {{hasError ? 'text-danger' : 'text-white-50'}}" l10nTranslate>{{ hasError || 'Two-Factor Authentication' }}</p>
<form (ngSubmit)="onSubmit2Fa()" [formGroup]="twoFaForm">
<div class="input-group mt-2 mb-4">
- @if (twoFaForm.value.isRecoveryCode) {
+ @if (isRecoveryCode) {
<span class="input-group-text">
<fa-icon [icon]="icons.faKey"></fa-icon>
</span>
@@ -43,7 +43,7 @@
<div class="d-flex mt-4">
<button type="button" (click)="onCancel2Fa()" class="btn btn-secondary px-4 w-50 me-3" l10nTranslate>Cancel</button>
<button type="submit"
- [disabled]="twoFaForm.value.isRecoveryCode ? twoFaForm.controls.recoveryCode.invalid : twoFaForm.controls.totpCode.invalid || submitted"
+ [disabled]="isRecoveryCode ? twoFaForm.controls.recoveryCode.invalid : twoFaForm.controls.totpCode.invalid || submitted"
class="btn btn-primary px-4 w-50" l10nTranslate>
Confirm
</button>
diff --git a/frontend/src/app/auth/auth.component.ts b/frontend/src/app/auth/auth.component.ts
index edede69a..2024eb1c 100644
--- a/frontend/src/app/auth/auth.component.ts
+++ b/frontend/src/app/auth/auth.component.ts
@@ -45,6 +45,9 @@ export class AuthComponent {
recoveryCode: this.fb.control('', [Validators.required, Validators.minLength(USER_PASSWORD_MIN_LENGTH)]),
isRecoveryCode: this.fb.control(false)
})
+ protected get isRecoveryCode(): boolean {
+ return Boolean(this.twoFaForm.get('isRecoveryCode')?.value)
+ }
constructor() {
if (this.oidcSettings && this.oidcSettings.autoRedirect) {
@@ -65,7 +68,7 @@ export class AuthComponent {
async onSubmit2Fa() {
this.submitted = true
- const code = this.twoFaForm.value.isRecoveryCode ? this.twoFaForm.value.recoveryCode : this.twoFaForm.value.totpCode
+ const code = this.isRecoveryCode ? this.twoFaForm.value.recoveryCode : this.twoFaForm.value.totpCode
if (this.auth.electron.enabled) {
this.auth.electron.register(this.loginForm.value.username, this.loginForm.value.password, code).subscribe({
@@ -73,7 +76,7 @@ export class AuthComponent {
error: (e) => this.is2FaVerified({ success: false, message: e.error ? e.error.message : e } as TwoFaResponseDto)
})
} else {
- this.auth.loginWith2Fa({ code: code, isRecoveryCode: this.twoFaForm.value.isRecoveryCode } satisfies TwoFaVerifyDto).subscribe({
+ this.auth.loginWith2Fa({ code: code, isRecoveryCode: this.isRecoveryCode } satisfies TwoFaVerifyDto).subscribe({
next: (res: TwoFaResponseDto) => this.is2FaVerified(res),
error: (e) => this.is2FaVerified({ success: false, message: e.error ? e.error.message : e } as TwoFaResponseDto)
})
diff --git a/frontend/src/styles/components/_app.scss b/frontend/src/styles/components/_app.scss
index 50ff288d..485b26c5 100755
--- a/frontend/src/styles/components/_app.scss
+++ b/frontend/src/styles/components/_app.scss
@@ -24,6 +24,17 @@
}
.body {
+ .btn.btn-primary {
+ @include btn-badge-dark-vars(#1d4ed833, #60a5fa66, #bfdbfe);
+ --btn-chip-bg: #203255;
+ --btn-chip-active-bg: white;
+ border-width: .5px !important;
+ }
+ .btn.btn-secondary {
+ @include btn-badge-dark-vars(#33415566, #64748b80, #e2e8f0);
+ border-width: .5px !important;
+ }
+
.input-group-text {
background: rgba(0, 0, 0, 0.3);
color: rgba(255, 255, 255, 0.8);