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