163 lines
5.1 KiB
HTML
163 lines
5.1 KiB
HTML
<section class="login-page">
|
|
<div class="login-panel">
|
|
<div class="brand-block">
|
|
<span class="eyebrow">SmartGuide Account Portal</span>
|
|
<h1>Login</h1>
|
|
<p>
|
|
Melde Dich mit Deiner Organisation an. Nach den Zugangsdaten erhältst Du
|
|
einen einmaligen Code per E-Mail.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="stepper" aria-label="Login-Fortschritt">
|
|
<div class="step" [class.step--active]="currentStep === 'credentials'">
|
|
<span>1</span>
|
|
<strong>Zugangsdaten</strong>
|
|
</div>
|
|
<div class="step-line"></div>
|
|
<div class="step" [class.step--active]="currentStep === 'otk'">
|
|
<span>2</span>
|
|
<strong>OTK-Code</strong>
|
|
</div>
|
|
</div>
|
|
|
|
@if (currentStep === 'credentials') {
|
|
<form
|
|
class="login-form"
|
|
[formGroup]="credentialsForm"
|
|
(ngSubmit)="requestOtk()">
|
|
<mat-form-field class="field" appearance="outline">
|
|
<mat-label>E-Mail-Adresse</mat-label>
|
|
<input
|
|
id="login-email"
|
|
matInput
|
|
type="email"
|
|
autocomplete="email"
|
|
formControlName="email" />
|
|
@if (credentialsForm.controls.email.hasError('required')) {
|
|
<mat-error>E-Mail-Adresse ist erforderlich.</mat-error>
|
|
} @else if (credentialsForm.controls.email.hasError('email')) {
|
|
<mat-error>Bitte gib eine gültige E-Mail-Adresse ein.</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<mat-form-field class="field" appearance="outline">
|
|
<mat-label>Passwort</mat-label>
|
|
<input
|
|
id="login-password"
|
|
matInput
|
|
[type]="showPassword ? 'text' : 'password'"
|
|
autocomplete="current-password"
|
|
formControlName="password" />
|
|
<button
|
|
mat-icon-button
|
|
matSuffix
|
|
type="button"
|
|
[attr.aria-label]="
|
|
showPassword ? 'Passwort verbergen' : 'Passwort anzeigen'
|
|
"
|
|
(click)="showPassword = !showPassword">
|
|
<mat-icon>{{
|
|
showPassword ? 'visibility' : 'visibility_off'
|
|
}}</mat-icon>
|
|
</button>
|
|
@if (credentialsForm.controls.password.hasError('required')) {
|
|
<mat-error>Passwort ist erforderlich.</mat-error>
|
|
} @else if (credentialsForm.controls.password.hasError('minlength')) {
|
|
<mat-error>Passwort muss mindestens 8 Zeichen haben.</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<button
|
|
mat-flat-button
|
|
color="primary"
|
|
class="submit-button"
|
|
type="submit"
|
|
[disabled]="credentialsForm.invalid || isSubmitting">
|
|
@if (isSubmitting) {
|
|
Code wird gesendet...
|
|
} @else {
|
|
Code per E-Mail senden
|
|
}
|
|
</button>
|
|
|
|
<div class="form-actions">
|
|
<span></span>
|
|
<a class="auth-link" routerLink="/forgot-password"
|
|
>Passwort vergessen?</a
|
|
>
|
|
</div>
|
|
</form>
|
|
} @else {
|
|
<form class="login-form" [formGroup]="otkForm" (ngSubmit)="login()">
|
|
<div class="code-intro">
|
|
<mat-icon>mark_email_unread</mat-icon>
|
|
<div>
|
|
<strong>Code eingeben</strong>
|
|
<span>
|
|
Wir haben den Code an
|
|
{{
|
|
credentialsForm.controls.email.value || 'Deine E-Mail-Adresse'
|
|
}}
|
|
gesendet.
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<mat-form-field class="field" appearance="outline">
|
|
<mat-label>OTK-Code</mat-label>
|
|
<input
|
|
id="login-otk"
|
|
matInput
|
|
inputmode="text"
|
|
autocomplete="one-time-code"
|
|
formControlName="code" />
|
|
@if (otkForm.controls.code.hasError('required')) {
|
|
<mat-error>OTK-Code ist erforderlich.</mat-error>
|
|
} @else if (otkForm.controls.code.hasError('pattern')) {
|
|
<mat-error>Bitte gib den Code aus der E-Mail ein.</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<div
|
|
class="expiry"
|
|
[class.expiry--expired]="codeExpiresIn === 0"
|
|
aria-live="polite">
|
|
<mat-icon>timer</mat-icon>
|
|
@if (codeExpiresIn > 0) {
|
|
<span>Code läuft in {{ formatCountdown() }} ab.</span>
|
|
} @else {
|
|
<span>Code ist abgelaufen. Bitte neuen Code anfordern.</span>
|
|
}
|
|
</div>
|
|
|
|
<button
|
|
mat-flat-button
|
|
color="primary"
|
|
class="submit-button"
|
|
type="submit"
|
|
[disabled]="otkForm.invalid || isSubmitting || codeExpiresIn === 0">
|
|
@if (isSubmitting) {
|
|
Anmeldung wird geprüft...
|
|
} @else {
|
|
Anmelden
|
|
}
|
|
</button>
|
|
|
|
<div class="form-actions">
|
|
<button
|
|
mat-button
|
|
type="button"
|
|
(click)="resendCode()"
|
|
[disabled]="isSubmitting">
|
|
Code erneut senden
|
|
</button>
|
|
<button mat-button type="button" (click)="editCredentials()">
|
|
E-Mail ändern
|
|
</button>
|
|
</div>
|
|
</form>
|
|
}
|
|
</div>
|
|
</section>
|