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