aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-edit/user-edit.component.html
blob: 2aca5ddca150a4afa108de19efd69a3ebc347c0d (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<div i18n class="form-sub-title" *ngIf="isCreation() === true">Create user</div>
<div i18n class="form-sub-title" *ngIf="isCreation() === false">Edit user {{ username }}</div>

<div *ngIf="error" class="alert alert-danger">{{ error }}</div>

<form role="form" (ngSubmit)="formValidated()" [formGroup]="form">
  <div class="form-group" *ngIf="isCreation()">
    <label i18n for="username">Username</label>
    <input
      type="text" id="username" i18n-placeholder placeholder="john"
      formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }"
    >
    <div *ngIf="formErrors.username" class="form-error">
      {{ formErrors.username }}
    </div>
  </div>

  <div class="form-group">
    <label i18n for="email">Email</label>
    <input
      type="text" id="email" i18n-placeholder placeholder="mail@example.com"
      formControlName="email" [ngClass]="{ 'input-error': formErrors['email'] }"
      autocomplete="off"
    >
    <div *ngIf="formErrors.email" class="form-error">
      {{ formErrors.email }}
    </div>
  </div>

  <div class="form-group" *ngIf="isCreation()">
    <label i18n for="password">Password</label>
    <my-help *ngIf="isPasswordOptional()">
      <ng-template ptTemplate="customHtml">
        <ng-container i18n>
          If you leave the password empty, an email will be sent to the user.
        </ng-container>
      </ng-template>
    </my-help>
    <input
      type="password" id="password" autocomplete="new-password"
      formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }"
    >
    <div *ngIf="formErrors.password" class="form-error">
      {{ formErrors.password }}
    </div>
  </div>

  <div class="form-group">
    <label i18n for="role">Role</label>
    <div class="peertube-select-container">
      <select id="role" formControlName="role">
        <option *ngFor="let role of getRoles()" [value]="role.value">
          {{ role.label }}
        </option>
      </select>
    </div>

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

  <div class="form-group">
    <label i18n for="videoQuota">Video quota</label>
    <div class="peertube-select-container">
      <select id="videoQuota" formControlName="videoQuota">
        <option *ngFor="let videoQuotaOption of videoQuotaOptions" [value]="videoQuotaOption.value">
          {{ videoQuotaOption.label }}
        </option>
      </select>
    </div>

    <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
      Transcoding is enabled on server. The video quota only take in account <strong>original</strong> video. <br />
      At most, this user could use ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}.
    </div>
  </div>

  <div class="form-group">
    <label i18n for="videoQuotaDaily">Daily video quota</label>
    <div class="peertube-select-container">
      <select id="videoQuotaDaily" formControlName="videoQuotaDaily">
        <option *ngFor="let videoQuotaDailyOption of videoQuotaDailyOptions" [value]="videoQuotaDailyOption.value">
          {{ videoQuotaDailyOption.label }}
        </option>
      </select>
    </div>
  </div>

  <div class="form-group">
    <my-peertube-checkbox
      inputName="byPassAutoBlacklist" formControlName="byPassAutoBlacklist"
      i18n-labelText labelText="Bypass video auto blacklist"
    ></my-peertube-checkbox>
  </div>

  <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
</form>

<div *ngIf="!isCreation()" class="danger-zone">
  <div class="account-title" i18n>Danger Zone</div>

  <div class="form-group reset-password-email">
    <label i18n>Send a link to reset the password by email to the user</label>
    <button (click)="resetPassword()" i18n>Ask for new password</button>
  </div>

  <div class="form-group">
    <label i18n>Manually set the user password</label>
    <my-user-password [userId]="userId"></my-user-password>
  </div>
</div>