{{template "base/base.html" .}}

{{define "meta"}}
<link href="/static/css/user.css" rel="stylesheet">
{{end}}

{{define "body"}}
<center><h2 class="form-signin-heading">Chagement de mot de passe</h2></center>
<form id="chPwdForm" class="form-signin" action="/user" method="POST">
  <label for="inputEmail" class="sr-only">Mot de passe</label>
  <input type="password" id="password1" name="password1" class="form-control" placeholder="Password" required>

  <label for="inputPassword" class="sr-only">Mot de passe</label>
  <input type="password" id="password2" name="password2" class="form-control" placeholder="Password" required>

  <button class="btn btn-lg btn-primary btn-block" type="submit">Enregistrer</button>
</form>
{{end}}

{{define "extrajs"}}
<script src="/static/js/jquery.sha256.min.js"></script>
<script type="application/javascript">
$("#chPwdForm").submit(function() {
    $('#password1').val($.sha256($('#password1').val()));
    console.log("Password1: "+$('#password1').val());
    $('#password2').val($.sha256($('#password2').val()));
    console.log("Password2: "+$('#password2').val());
    
    return $('#password1').val() == $('#password2').val();
});
</script>
{{end}}
