1
{% extends "layout.html" %}
2
{%block head%}
3
<style type="text/css">
4
  .form-signin {
5
    max-width: 300px;
6
    padding: 19px 29px 29px;
7
    margin: 0 auto 20px;
8
    background-color: #fff;
9
    border: 1px solid #e5e5e5;
10
    -webkit-border-radius: 5px;
11
    -moz-border-radius: 5px;
12
    border-radius: 5px;
13
    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
14
    -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
15
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
16
  }
17
18
  .form-signin .form-signin-heading,
19
  .form-signin .checkbox {
20
    margin-bottom: 10px;
21
  }
22
23
  .form-signin input[type="text"],
24
  .form-signin input[type="password"] {
25
    font-size: 16px;
26
    height: auto;
27
    margin-bottom: 15px;
28
    padding: 7px 9px;
29
  }
30
</style>
31
{% endblock %}
32
33
{% block body %}
34
{% if session.logged_in %}
35
<div class="form-signin">
36
  <h2 class="form-signin-heading">Please create a user and assign a key</h2>
37
  <input type=text id="user" name=user class="input-block-level" placeholder="Name">
38
  <input id="password" class="input-block-level" type=password size=30 name=title placeholder="Password">
39
  <button class="btn btn-large btn-primary" type=submit onclick="encryptAndSend();">Submit</button>
40
</div>
41
{% endif %}
42
43
<script type="text/javascript">
44
  function encryptAndSend() {
45
    var key = {{ session.key | tojson | safe }};
46
    var data = $('#password').val();
47
    $.post({{ url_for('user') | tojson | safe }}, {'user': $("#user").val(), 'key': data},
48
      function(data) {
49
        /*TODO: In the UI flash a "check mark", to indicate success.*/
50
        $("button").addClass("btn-success");
51
        console.log("Success");
52
      });
53
  }
54
</script>
55
<script src="{{url_for('static', filename='js/jquery-1.9.1.min.js')}}"></script>
56
<!-- <script src="{{ url_for('static', filename='sjcl.js') }}" type="text/javascript"></script> -->
57
{% endblock %}