summaryrefslogtreecommitdiffstats
path: root/mongoose/examples/html/login.html
blob: 38dcc89f09e460162f36f1ee58a3d5265a7f2859 (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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> 
  <!-- This file is part of the  Mongoose project,
    http://code.google.com/p/mongoose -->
  <head>
    <title>Mongoose chat: login</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <!--
      Note that this page is self-sufficient, it does not load any other
      CSS or Javascript file. This is done so because only this page is
      allowed for non-authorized users. If we want to load other files
      from the frontend, we need to change backend code to allow those
      for non-authorized users. See chat.c :: must_authorize() function.
    -->
  </head>

  <script>
    window.onload = function() {
      // Set correct action for the login form. We assume that the SSL port
      // is the next one to insecure one.
      var httpsPort = location.protocol.match(/https/) ? location.port :
        parseInt(location.port) + 1;
      document.forms[0].action = 'https://' + location.hostname + ':' +
        httpsPort + '/authorize';
    };
  </script>

  <body>
    <center>
      <h2>Mongoose chat server login</h2>
      <div style="max-width: 30em;">
        Username and password can be any non-empty strings.
      </div>
      <br/>
      <form>
        <input type="text" name="user"></input><br/>
        <input type="text" name="password"></input><br/>
        <input type="submit" value="Login"></input>
      </form>
    </center>
  </body>
</html>