<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<div ng-controller="UserController">
  <div id="form-container" class="col-md-12 col-md-offset-3">

    <div>
      <div class="page-header">
        <span>Password reset</span>
      </div>
      <div class="breadcrumb-header text-center">
        <div id="status-buttons" class="btn-group btn-breadcrumb">
          <a class="btn btn-default breadcrumb-btn-elem breadcrumb-home" ng-click="logout()"
             tabindex="0" ng-enter="logout()">
            <i class="fa fa-home"></i>
          </a>
          <!--add class breadcrumb-disabled-link to buttons to prevent click-->
          <a ui-sref-active="active" tabindex="0"
             class="btn btn-secondary btn-default active">{{'USERDETAILS'| translate}}</a>
        </div>
      </div>
      <form class="signup-form" name="passwordResetForm" ng-submit="resetPassword(user)" novalidate>

        <div id="form-views" ui-view>
          <div id="attribute" class="form-group">
            <label for="user.username">{{'USER'| translate}}</label>
            <input name="username" type="text" class="form-control" ng-model="user.username" required 
                   placeholder="{{'USERNAME_PLACEHOLDER'|translate}}" ng-blur="retrieveSecurityQuestion(user)">
            <p ng-show="(userForm.username.$error.required && !userForm.username.$pristine)" 
               class="text-validation-error">Username is required</p>
          </div>
          <div id="attribute" class="form-group" ng-show="$root.pwdResetRequiringSecurityQuestions">
            <label for="user.securityquestion">{{'SECURITYQUESTION'| translate}}</label> 
            <div class="suggestions">(Not Loading? <a href ng-click="retrieveSecurityQuestion(user)">Reload</a>)</div>
            <input name="securityquestion" type="text" class="form-control" ng-model="userSecurityQuestion" 
                   disabled="disabled">              
          </div>
          <div id="attribute" class="form-group" ng-show="$root.pwdResetRequiringSecurityQuestions">
            <label for="user.securityAnswer">{{'SECURITYANSWER'| translate}}</label>
            <input name="securityAnswer" type="text" class="form-control" ng-model="user.securityAnswer" 
                   placeholder="{{'SECURITYANSWER_PLACEHOLDER'| translate}}" id="securityAnswer">              
          </div>
          <div id="attribute" class="form-group row">
            <!--captcha-->
            <div class="form-group row">
              <div class="col-md-12">
                <captcha input="captchaInput" enabled="captchaEnabled"></captcha>
              </div>
            </div>
            <div class="col-xs-6">
              <a id="cancel" class="btn btn-danger float-left nav-button" tabindex="0" ng-click="logout()"
                 tabindex="0" ng-enter="logout()">
                {{'CANCEL'| translate}}
              </a>
            </div>
            <div class="col-xs-6">
              <button id="resetpassword" type="submit" tabindex="0"
                      class="btn btn-secondary btn-default float-right nav-button">
                {{'SUBMIT'| translate}}
              </button>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
