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
  <form method="POST" action="/user/">
38
    <input type="text" id="user" name="user" class="input-block-level" placeholder="Name">
39
    <input id="password" class="input-block-level" type="password" size="30" name="key" placeholder="Password">
40
    <input class="btn btn-large btn-primary" type="submit" value="Submit">
41
  </form>
42
</div>
43
{% endif %}
44
45
<script type="text/javascript">
46
  function encryptAndSend() {
47
    var key = {{ session.key | tojson | safe }};
48
    var data = $('#password').val();
49
    $.post({{ url_for('user') | tojson | safe }}, {'user': $("#user").val(), 'key': data},
50
      function(data) {
51
        /*TODO: In the UI flash a "check mark", to indicate success.*/
52
        $("button").addClass("btn-success");
53
        console.log("Success");
54
      });
55
  }
56
</script>
57
<script src="{{url_for('static', filename='js/jquery-1.9.1.min.js')}}"></script>
58
<!-- <script src="{{ url_for('static', filename='sjcl.js') }}" type="text/javascript"></script> -->
59
{% endblock %}