<!--
-
- Copyright (C) 2019 Xilinx, Inc.  All rights reserved.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-
-
- Author: Michael Chyziak <chyziak@xilinx.com>
-
-->


{% extends "Default/default.html" %}
{% block content %}

<div class="page-header">
  <h1 class="display-4"><b>{% block title %}Change Root Password{% endblock %}</b></h1>
</div>
 
 	<div class="alert alert-success alert-dismissable" style="display: {{ success }}" id="info_success">
	  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
          <strong>Successfully changed root password!</strong>
	</div>
	<div class="alert alert-danger alert-dismissable" style="display: none" id="info_password_mismatch">
	  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
          <strong>ERROR: Password do not match. Try again.</strong>
	</div>
	<div class="alert alert-danger alert-dismissable" style="display: {{ failure }}" id="server_failed">
	  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
          <strong>ERROR: Could not change root password.</strong>
	</div>       
 
	<form action='password.html' onsubmit='return passwordMatch()' method="post">
          <p>Change the root password on the Ultra96.</p>
	  <div class="form-group">
	    <label for="oldpassword">Current Password:</label>
	    <input name="oldpassword" type="password" class="form-control" id="oldpassword">
	  </div>
	  <div class="form-group">
	    <label for="newpassword">New Password:</label>
	    <input name="newpassword" type="password" class="form-control" id="newpassword">
	  </div>
	  <div class="form-group">
	    <label for="newpassword">Confirm Password:</label>
	    <input type="password" class="form-control" id="confirmpassword">
	  </div>
	  <div class="alert alert-warning">
	    <strong>WARNING:</strong>It is important to always remember the root password.
	  </div>
	  <div>
	    <button type="submit" class="btn btn-default">Request Change</button>
	  </div>
	</form>
	
       	<script>
	  function passwordMatch(){
	    var orig_pass = document.getElementById("newpassword").value;
	    var conf_pass = document.getElementById("confirmpassword").value;
	    document.getElementById("info_password_mismatch").style.display="hidden";
	    if (orig_pass == conf_pass){
	      return true;
	    } else {
              document.getElementById("info_password_mismatch").style.display="block";
	      return false;
	    }
	  }
	</script>

  
{% endblock %}
