Skip to content

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

chore(frontend:auth): reorder buttons & adapt translations

johaven7f673250b05c
diff --git a/backend/src/authentication/guards/auth-two-fa-guard.ts b/backend/src/authentication/guards/auth-two-fa-guard.ts
index 6071e6f6..ca893759 100644
--- a/backend/src/authentication/guards/auth-two-fa-guard.ts
+++ b/backend/src/authentication/guards/auth-two-fa-guard.ts
@@ -30,7 +30,6 @@ function AuthTwoFaGuardFactory(options: TwoFaGuardOptions = { withPassword: true
if (!req.headers[TWO_FA_HEADER_PASSWORD]) {
throw new HttpException('Missing TWO-FA password', HttpStatus.FORBIDDEN)
}
-
await this.authMethod2FA.verifyUserPassword(user, req.headers[TWO_FA_HEADER_PASSWORD] as string, req.ip)
}
diff --git a/backend/src/authentication/services/auth-methods/auth-method-two-fa.service.ts b/backend/src/authentication/services/auth-methods/auth-method-two-fa.service.ts
index cca5a632..b9f50ec2 100644
--- a/backend/src/authentication/services/auth-methods/auth-method-two-fa.service.ts
+++ b/backend/src/authentication/services/auth-methods/auth-method-two-fa.service.ts
@@ -119,13 +119,15 @@ export class AuthMethod2FA {
}
async verifyUserPassword(user: UserModel, password: string, ip: string) {
+ // This function works with any authentication method, provided that
+ // the authentication service implements proper user password updates in the database.
if (!(await this.usersManager.compareUserPassword(user.id, password))) {
this.usersManager.updateAccesses(user, ip, false, true).catch((e: Error) => this.logger.error(`${this.enableTwoFactor.name} - ${e}`))
throw new HttpException('Incorrect code or password', HttpStatus.BAD_REQUEST)
}
}
- private validateTwoFactorCode(code: string, encryptedSecret: string): TwoFaVerifyResult {
+ validateTwoFactorCode(code: string, encryptedSecret: string): TwoFaVerifyResult {
const auth: TwoFaVerifyResult = { success: false, message: '' }
if (!encryptedSecret) {
auth.message = 'Incorrect code or password'
diff --git a/frontend/src/app/auth/auth.component.html b/frontend/src/app/auth/auth.component.html
index 4a097bb6..b1dc6a13 100644
--- a/frontend/src/app/auth/auth.component.html
+++ b/frontend/src/app/auth/auth.component.html
@@ -12,7 +12,7 @@
</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-sm 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) {
@@ -26,10 +26,10 @@
formControlName="recoveryCode" />
} @else {
<span class="input-group-text">
- <fa-icon [icon]="icons.faQrcode"></fa-icon>
- </span>
+ <fa-icon [icon]="icons.faQrcode"></fa-icon>
+ </span>
<input appAutofocus
- [placeholder]="'TOTP code' | translate:locale.language"
+ [placeholder]="'Authentication code' | translate:locale.language"
type="text"
class="form-control"
formControlName="totpCode"
@@ -47,12 +47,12 @@
</div>
</div>
<div class="d-flex mt-4">
+ <button type="button" (click)="onCancel2Fa()" class="btn btn-secondary px-4 w-50 me-2" l10nTranslate>Cancel</button>
<button type="submit"
[disabled]="twoFaForm.value.isRecoveryCode ? twoFaForm.controls.recoveryCode.invalid : twoFaForm.controls.totpCode.invalid || submitted"
- class="btn btn-primary px-4 w-50 me-2" l10nTranslate>
+ class="btn btn-primary px-4 w-50" l10nTranslate>
Confirm
</button>
- <button type="button" (click)="onCancel2Fa()" class="btn btn-secondary px-4 w-50" l10nTranslate>Cancel</button>
</div>
</form>
} @else {
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index 8c876dd4..f526027c 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -681,7 +681,7 @@
"Security": "Sécurité",
"Recovery code": "Code de récupération",
"Use a recovery code": "Utiliser un code de récupération",
- "TOTP code": "Code TOTP",
+ "Authentication code": "Code d'authentification",
"TOTP Verification": "Vérification TOTP",
"Secret copied": "Secret copié",
"Recovery codes copied": "Codes de récupération copiés",