1*afc8a799Smiramurali23<div class="uib-modal__content  modal__local-users">
2*afc8a799Smiramurali23  <div class="modal-header">
3*afc8a799Smiramurali23    <h2 class="modal-title" id="dialog_label">
4*afc8a799Smiramurali23      {{ modalCtrl.user.new ? 'Add user' : 'Modify user' }}
5*afc8a799Smiramurali23    </h2>
6*afc8a799Smiramurali23    <button type="button" class="btn  btn--close" ng-click="$dismiss()" aria-label="Close">
7*afc8a799Smiramurali23      <icon file="icon-close.svg" aria-hidden="true"></icon>
8*afc8a799Smiramurali23    </button>
9*afc8a799Smiramurali23  </div>
10*afc8a799Smiramurali23  <form name="form">
11*afc8a799Smiramurali23    <div class="modal-body">
12*afc8a799Smiramurali23      <!-- Manual unlock -->
13*afc8a799Smiramurali23      <div class="row" ng-if="modalCtrl.user.locked && !modalCtrl.automaticLockout">
14*afc8a799Smiramurali23        <div class="column medium-9">
15*afc8a799Smiramurali23          <div class="notification-banner"
16*afc8a799Smiramurali23               aria-live="polite"
17*afc8a799Smiramurali23               ng-class="{'notification-banner--warning': !form.lock.$dirty,
18*afc8a799Smiramurali23                          'notification-banner--information': form.lock.$dirty}">
19*afc8a799Smiramurali23            <p class="notification-banner__text" ng-if="!form.lock.$dirty">Account locked</p>
20*afc8a799Smiramurali23            <p class="notification-banner__text" ng-if="form.lock.$dirty">Click "Save" to unlock account</p>
21*afc8a799Smiramurali23          </div>
22*afc8a799Smiramurali23        </div>
23*afc8a799Smiramurali23        <div class="column medium-3">
24*afc8a799Smiramurali23          <input
25*afc8a799Smiramurali23            type="hidden"
26*afc8a799Smiramurali23            name="lock"
27*afc8a799Smiramurali23            ng-model="modalCtrl.manualUnlockProperty"
28*afc8a799Smiramurali23            value="false">
29*afc8a799Smiramurali23          <button class="btn btn-primary"
30*afc8a799Smiramurali23                  type="button"
31*afc8a799Smiramurali23                  ng-click="form.lock.$setDirty()"
32*afc8a799Smiramurali23                  ng-disabled="form.lock.$dirty">Unlock</button>
33*afc8a799Smiramurali23        </div>
34*afc8a799Smiramurali23      </div>
35*afc8a799Smiramurali23      <div class="row">
36*afc8a799Smiramurali23        <div class="column medium-6">
37*afc8a799Smiramurali23            <!-- Account Status -->
38*afc8a799Smiramurali23            <fieldset class="field-group-container">
39*afc8a799Smiramurali23              <legend>Account Status</legend>
40*afc8a799Smiramurali23              <label class="radio-label">
41*afc8a799Smiramurali23                <input type="radio"
42*afc8a799Smiramurali23                       name="accountStatus"
43*afc8a799Smiramurali23                       ng-value="true"
44*afc8a799Smiramurali23                       ng-model="modalCtrl.user.accountStatus"
45*afc8a799Smiramurali23                       ng-disabled="modalCtrl.user.isRoot">
46*afc8a799Smiramurali23                Enabled
47*afc8a799Smiramurali23              </label>
48*afc8a799Smiramurali23              <label class="radio-label">
49*afc8a799Smiramurali23                <input type="radio"
50*afc8a799Smiramurali23                       name="accountStatus1"
51*afc8a799Smiramurali23                       ng-value="false"
52*afc8a799Smiramurali23                       ng-model="modalCtrl.user.accountStatus"
53*afc8a799Smiramurali23                       ng-disabled="modalCtrl.user.isRoot">
54*afc8a799Smiramurali23                Disabled
55*afc8a799Smiramurali23              </label>
56*afc8a799Smiramurali23            </fieldset>
57*afc8a799Smiramurali23            <!-- Username -->
58*afc8a799Smiramurali23            <div class="field-group-container">
59*afc8a799Smiramurali23              <label for="username">Username</label>
60*afc8a799Smiramurali23              <p class="label__helper-text">Cannot start with a number</p>
61*afc8a799Smiramurali23              <p class="label__helper-text">No special characters except underscore</p>
62*afc8a799Smiramurali23              <input id="username"
63*afc8a799Smiramurali23                     name="username"
64*afc8a799Smiramurali23                     type="text"
65*afc8a799Smiramurali23                     required
66*afc8a799Smiramurali23                     minlength="1"
67*afc8a799Smiramurali23                     maxlength="16"
68*afc8a799Smiramurali23                     ng-pattern="'^([a-zA-Z_][a-zA-Z0-9_]*)'"
69*afc8a799Smiramurali23                     ng-readonly="modalCtrl.user.isRoot"
70*afc8a799Smiramurali23                     ng-model="modalCtrl.user.username"
71*afc8a799Smiramurali23                     username-validator
72*afc8a799Smiramurali23                     existing-usernames="modalCtrl.existingUsernames"/>
73*afc8a799Smiramurali23              <div ng-if="form.username.$invalid && form.username.$touched" class="form__validation-message">
74*afc8a799Smiramurali23                <span ng-show="form.username.$error.required">
75*afc8a799Smiramurali23                  Field is required</span>
76*afc8a799Smiramurali23                <span ng-show="form.username.$error.minlength || form.username.$error.maxlength">
77*afc8a799Smiramurali23                  Length must be between <span class="nowrap">1 – 16</span> characters</span>
78*afc8a799Smiramurali23                <span ng-show="form.username.$error.pattern">
79*afc8a799Smiramurali23                  Invalid format</span>
80*afc8a799Smiramurali23                <span ng-show="form.username.$error.duplicateUsername">
81*afc8a799Smiramurali23                  Username already exists</span>
82*afc8a799Smiramurali23              </div>
83*afc8a799Smiramurali23            </div>
84*afc8a799Smiramurali23            <!-- Privlege -->
85*afc8a799Smiramurali23            <div class="field-group-container">
86*afc8a799Smiramurali23              <label for="privilege">Privilege</label>
87*afc8a799Smiramurali23              <select id="privilege"
88*afc8a799Smiramurali23                      name="privilege"
89*afc8a799Smiramurali23                      required
90*afc8a799Smiramurali23                      ng-disabled="modalCtrl.user.isRoot"
91*afc8a799Smiramurali23                      ng-model="modalCtrl.user.privilege">
92*afc8a799Smiramurali23                <option ng-if="modalCtrl.user.new"
93*afc8a799Smiramurali23                        ng-selected="modalCtrl.user.new"
94*afc8a799Smiramurali23                        value=""
95*afc8a799Smiramurali23                        disabled>
96*afc8a799Smiramurali23                  Select an option
97*afc8a799Smiramurali23                </option>
98*afc8a799Smiramurali23                <option ng-value="role"
99*afc8a799Smiramurali23                        ng-repeat="role in modalCtrl.privilegeRoles">
100*afc8a799Smiramurali23                  {{role}}
101*afc8a799Smiramurali23                </option>
102*afc8a799Smiramurali23              </select>
103*afc8a799Smiramurali23            </div>
104*afc8a799Smiramurali23        </div>
105*afc8a799Smiramurali23        <div class="column medium-6">
106*afc8a799Smiramurali23           <!-- Password -->
107*afc8a799Smiramurali23           <div class="field-group-container">
108*afc8a799Smiramurali23            <label for="password">User password</label>
109*afc8a799Smiramurali23            <p class="label__helper-text">Password must between <span class="nowrap">{{modalCtrl.minPasswordLength}} – {{modalCtrl.maxPasswordLength}}</span> characters</p>
110*afc8a799Smiramurali23            <input id="password"
111*afc8a799Smiramurali23                   name="password"
112*afc8a799Smiramurali23                   type="password"
113*afc8a799Smiramurali23                   ng-minlength="modalCtrl.minPasswordLength"
114*afc8a799Smiramurali23                   ng-maxlength="modalCtrl.maxPasswordLength"
115*afc8a799Smiramurali23                   autocomplete="new-password"
116*afc8a799Smiramurali23                   ng-required="modalCtrl.user.new || form.password.$touched || form.passwordConfirm.$touched"
117*afc8a799Smiramurali23                   ng-model="modalCtrl.user.password"
118*afc8a799Smiramurali23                   password-visibility-toggle
119*afc8a799Smiramurali23                   ng-click="form.password.$setTouched()"
120*afc8a799Smiramurali23                   placeholder="{{
121*afc8a799Smiramurali23                    (modalCtrl.user.new ||
122*afc8a799Smiramurali23                    form.password.$touched ||
123*afc8a799Smiramurali23                    form.passwordConfirm.$touched) ? '' : '******'}}"/>
124*afc8a799Smiramurali23            <div ng-if="form.password.$invalid && form.password.$dirty" class="form__validation-message">
125*afc8a799Smiramurali23              <span ng-show="form.password.$error.required">
126*afc8a799Smiramurali23                Field is required</span>
127*afc8a799Smiramurali23              <span ng-show="form.password.$error.minlength || form.password.$error.maxlength">
128*afc8a799Smiramurali23                Length must be between <span class="nowrap">{{modalCtrl.minPasswordLength}} – {{modalCtrl.maxPasswordLength}}</span> characters</span>
129*afc8a799Smiramurali23            </div>
130*afc8a799Smiramurali23          </div>
131*afc8a799Smiramurali23          <!-- Password confirm -->
132*afc8a799Smiramurali23          <div class="field-group-container">
133*afc8a799Smiramurali23            <label for="passwordConfirm">Confirm user password</label>
134*afc8a799Smiramurali23            <input id="passwordConfirm"
135*afc8a799Smiramurali23                   name="passwordConfirm"
136*afc8a799Smiramurali23                   type="password"
137*afc8a799Smiramurali23                   autocomplete="new-password"
138*afc8a799Smiramurali23                   ng-required="modalCtrl.user.new || form.password.$touched || form.passwordConfirm.$touched"
139*afc8a799Smiramurali23                   ng-model="modalCtrl.user.passwordConfirm"
140*afc8a799Smiramurali23                   password-visibility-toggle
141*afc8a799Smiramurali23                   password-confirm
142*afc8a799Smiramurali23                   first-password="form.password.$modelValue"
143*afc8a799Smiramurali23                   ng-click="form.passwordConfirm.$setTouched()"
144*afc8a799Smiramurali23                   placeholder="{{(
145*afc8a799Smiramurali23                    modalCtrl.user.new ||
146*afc8a799Smiramurali23                    form.password.$touched ||
147*afc8a799Smiramurali23                    form.passwordConfirm.$touched) ? '' : '******'}}"/>
148*afc8a799Smiramurali23            <div ng-if="form.passwordConfirm.$invalid && form.passwordConfirm.$dirty" class="form__validation-message">
149*afc8a799Smiramurali23              <span ng-show="form.passwordConfirm.$error.required">
150*afc8a799Smiramurali23                Field is required</span>
151*afc8a799Smiramurali23              <span ng-show="form.passwordConfirm.$error.passwordConfirm"
152*afc8a799Smiramurali23                    ng-hide="form.passwordConfirm.$error.required">
153*afc8a799Smiramurali23                Passwords do not match</span>
154*afc8a799Smiramurali23              <span ng-show="form.passwordConfirm.$error.minlength || form.passwordConfirm.$error.maxlength">
155*afc8a799Smiramurali23                Length must be between <span class="nowrap">1 – 16</span> characters</span>
156*afc8a799Smiramurali23            </div>
157*afc8a799Smiramurali23          </div>
158*afc8a799Smiramurali23        </div>
159*afc8a799Smiramurali23      </div>
160*afc8a799Smiramurali23    </div>
161*afc8a799Smiramurali23    <div class="modal-footer">
162*afc8a799Smiramurali23      <button class="btn btn-secondary" ng-click="$dismiss()" type="button">
163*afc8a799Smiramurali23        Cancel
164*afc8a799Smiramurali23      </button>
165*afc8a799Smiramurali23      <button class="btn btn-primary"
166*afc8a799Smiramurali23              type="submit"
167*afc8a799Smiramurali23              ng-click="$close(form)"
168*afc8a799Smiramurali23              ng-disabled="form.$invalid || form.$pristine"
169*afc8a799Smiramurali23              ng-class="{'disabled': form.$invalid}">
170*afc8a799Smiramurali23        {{ modalCtrl.user.new ? 'Add user' : 'Save' }}
171*afc8a799Smiramurali23      </button>
172*afc8a799Smiramurali23    </div>
173*afc8a799Smiramurali23  </form>
174*afc8a799Smiramurali23</div>
175