Chocobozzz/PeerTube

View on GitHub
client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html

Summary

Maintainability
Test Coverage
<my-alert *ngIf="error" type="danger">{{ error }}</my-alert>
<my-alert *ngIf="success" type="success">{{ success }}</my-alert>

<div i18n class="pending-email" *ngIf="user.pendingEmail">
  <strong>{{ user.pendingEmail }}</strong> is awaiting email verification
</div>

<form class="change-email" (ngSubmit)="changeEmail()" [formGroup]="form">

  <div class="form-group">
    <label i18n for="new-email">Change your email</label>

    <div i18n class="form-group-description">
      Your current email is <strong>{{ user.email }}</strong>.
      It is never shown to the public.
    </div>

    <input
      type="email" id="new-email" i18n-placeholder placeholder="New email" class="form-control"
      formControlName="new-email" [ngClass]="{ 'input-error': formErrors['new-email'] }"
    >
    <div *ngIf="formErrors['new-email']" class="form-error" role="alert">
      {{ formErrors['new-email'] }}
    </div>
  </div>

  <div class="form-group">
    <my-input-text
      formControlName="password" inputId="password" i18n-placeholder placeholder="Current password"
      [formError]="formErrors['password']" autocomplete="current-password"
    ></my-input-text>
  </div>

  <input type="submit" i18n-value value="Change email" [disabled]="!form.valid">
</form>