<!--
This is the directive for assigning users.
-->
<div class="form-group">
    <label for="realm" translate>Realm</label>
    <select class="form-control" id="realm"
            name="realm" ng-model="newUserObject.realm"
            ng-options="realmname as realmname for (realmname, realm) in realms">
    </select>
    <div ng-show="enableRealmOnly">
        <input type="checkbox" id="realmOnly"
               ng-model="newUserObject.realmOnly">
        <label for="realmOnly" translate>Only add to the realm (no user assignment)</label>
    </div>
</div>

<div class="form-group">
    <label for="username" translate>Username</label>
    <input name="username" id="username" type="text" ng-model="newUserObject.user"
           autocomplete="new-password"
           placeholder="{{ 'start typing a username'|translate }}"
           ng-keypress="toggleLoadUsers($event.which==13)"
           typeahead-wait-ms="100"
           typeahead-focus-first="true"
           uib-typeahead="newuser for newuser in loadUsers($viewValue)"
           typeahead-no-results="noResults"
           typeahead-loading="loadingUsers" class="form-control"
           ng-disabled="newUserObject.realmOnly">
    <div ng-show="loadingUsers">
        <i class="glyphicon glyphicon-refresh"></i><span translate>Loading users...</span>
    </div>
    <div ng-show="noResults">
        <i class="glyphicon glyphicon-remove"></i><span translate>No user found</span>
    </div>
</div>
<div class="form-group" ng-show="enableSetPin">
    <!-- we could add a checkRight("enrollpin") here,
        but this would not be quite accurate, since this directive is
        also used during assigning and not only during enrolling!
        -->
    <label for="otppin" translate>PIN/Password</label>
    <input name="otppin" id="otppin" ng-model="newUserObject.pin"
           autocomplete="new-password"
           type=password class="form-control"
           equals="{{ pin2 }}"
           placeholder="{{ 'Type a PIN or password'|translate }}">
    <input name="otppin2" ng-model="pin2"
           autocomplete="new-password"
           type=password class="form-control"
           equals="{{ newUserObject.pin }}"
           placeholder="{{ 'Repeat PIN or password'|translate }}">
</div>
