summaryrefslogtreecommitdiff
path: root/index.html
blob: a07f16de00c8248696142afbd38682a0c4971087 (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
<!DOCTYPE HTML>
<html>
 <head>
  <title>Radio Helsinki - Automation Import</title>
  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="/styles/import.css" />
  <script src="/javascript/jquery/jquery.min.js"></script>
  <script type="text/javascript">
    function authSuccess(data) {
       alert("username: " + data.username + "\ntoken: " + data.token );
    }

    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
              });
    }

    $("#loginform").submit(function(event) {
      auth()
      event.preventDefault();
    });
  </script>
 </head>
 <body>
   <h1>Radio Helsinki - Automation Import</h1>
   <form id="loginform">
     <ul>
       <li> <label for="name">Benutzername:</label> <input type="text" id="username" value=""> </li>
       <li> <label for="pass">Kennwort:</label> <input type="password" id="password" value=""> </li>
       <li> <input type="submit" value="Einloggen"> </li>
     </ul>
   </form>

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