aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/login/login.component.html
blob: 9b8146624ca0ac0e8e112357bde1bd3c5b07a9d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<div class="margin-content">
  <div i18n class="title-page title-page-single">
    Login
  </div>

  <div *ngIf="error" class="alert alert-danger">{{ error }}
    <span *ngIf="error === 'User email is not verified.'"> <a i18n routerLink="/verify-account/ask-send-email">Request new verification email.</a></span>
  </div>

  <form role="form" (ngSubmit)="login()" [formGroup]="form">
    <div class="form-group">
      <div>
        <label i18n for="username">User</label>
        <input
          type="text" id="username" i18n-placeholder placeholder="Username or email address" required tabindex="1"
          formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }" #emailInput
        >
        <a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account">
          or create an account
        </a>

        <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#instances-list" target="_blank" title="Click here to see a list of instances where to register" class="create-an-account">
          or create an account on another instance
        </a>

        <my-help
          *ngIf="signupAllowed === false" helpType="custom" i18n-customHtml
          customHtml="User registration is not allowed on this instance, but you can register on many others!"
        ></my-help>
      </div>

      <div *ngIf="formErrors.username" class="form-error">
        {{ formErrors.username }}
      </div>
    </div>

    <div class="form-group">
      <label i18n for="password">Password</label>
      <div>
        <input
          type="password" name="password" id="password" i18n-placeholder placeholder="Password" required tabindex="2"
          formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }"
        >
        <a i18n class="forgot-password-button" (click)="openForgotPasswordModal()" title="Click here to reset your password">I forgot my password</a>
      </div>
      <div *ngIf="formErrors.password" class="form-error">
        {{ formErrors.password }}
      </div>
    </div>

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

<ng-template #forgotPasswordModal>
  <div class="modal-header">
    <h4 i18n class="modal-title">Forgot your password</h4>
    <span class="close" aria-hidden="true" (click)="hideForgotPasswordModal()"></span>
  </div>

  <div class="modal-body">

    <div *ngIf="isEmailDisabled()" class="alert alert-danger" i18n>
      We are sorry, you cannot recover you password because your instance administrator did not configure the PeerTube email system.
    </div>

    <div class="form-group" [hidden]="isEmailDisabled()">
      <label i18n for="forgot-password-email">Email</label>
      <input
        type="email" id="forgot-password-email" i18n-placeholder placeholder="Email address" required
        [(ngModel)]="forgotPasswordEmail" #forgotPasswordEmailInput
      >
    </div>
  </div>

  <div class="modal-footer inputs">
    <span i18n class="action-button action-button-cancel" (click)="hideForgotPasswordModal()">Cancel</span>

    <input
      type="submit" i18n-value value="Send me an email to reset my password" class="action-button-submit"
      (click)="askResetPassword()" [disabled]="!forgotPasswordEmailInput.validity.valid"
    >
  </div>
</ng-template>