summaryrefslogtreecommitdiff
path: root/index.html
blob: 92459a5270ded2cfc52843a6dc99522f17201930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE HTML>
<html>
 <head>
  <title>Radio Helsinki - Automation Import</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Importtool for Radio Helsinki">
  <meta name="author" content="Christian Pointner <equinox@ffgraz.net>">

  <link href="/javascript/twitter-bootstrap/css/bootstrap.css" rel="stylesheet">
  <style type="text/css">
    body {
      padding-top: 60px;
      padding-bottom: 40px;
    }

    .sidebar-nav {
      padding: 9px 0;
    }

    .form-signin {
      max-width: 330px;
      padding: 15px;
      margin: 0 auto;
    }
    .form-signin .form-signin-heading {
      margin-bottom: 10px;
    }
    .form-signin .form-control {
      position: relative;
      height: auto;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      padding: 10px;
      font-size: 16px;
    }
    .form-signin .form-control:focus {
      z-index: 2;
    }
    .form-signin input[type="text"] {
      margin-bottom: -1px;
      border-bottom-right-radius: 0;
      border-bottom-left-radius: 0;
    }
    .form-signin input[type="password"] {
      margin-bottom: 10px;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
    .form-signin button[type="submit"] {
      display: block;
    }
  </style>
  <link href="/javascript/twitter-bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

  <script src="/javascript/jquery/jquery.min.js"></script>

  <script type="text/javascript">
    function authSuccess(data) {
       if (data.status == 'OK') {
         alert("username: " + data.username + "\ntoken: " + data.token );
       } else {
         alert("login error: " + data.errorstring);
       }
    }

    function authError(req, status, error) {
       alert(status + ": '" + error + "'")
    }

    function auth()
    {
      $.ajax("/authtoken.json",
              { cache: false,
                username: $("#username").val(),
                password: $("#password").val(),
                dataType: "json",
                error: authError,
                success: authSuccess
              });
    }
  </script>
 </head>
 <body>

  <div class="container">
    <form id="loginform" class="form-signin" role="form">
      <h1>Radio Helsinki - Import</h1>
      <h2 class="form-signin-heading">Please sign in</h2>
      <input id="username" type="text" class="form-control" placeholder="Username" required autofocus>
      <input id="password" type="password" class="form-control" placeholder="Password" required>
      <button class="btn btn-primary btn-large" type="submit"><i class="icon-user icon-white"></i> Sign in</button>
    </form>
  </div>

  <script type="text/javascript">
    $("#loginform").submit(function(event) { auth(); event.preventDefault(); });
  </script>
 </body>
</html>