summaryrefslogtreecommitdiff
path: root/template/req_reset.st
blob: 86986c0141eba6e02686b1433f5c3cf2ec152b96 (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
<html>
  <head>
    <title>dump.fm Password Reset</title>

$head()$

    <style>
      #main {      
      padding: 10px 2em 0px 2em;
      }
      label {
          float: left;
          width: 150px;
      }
      .error {
          border: 1px solid red;
      }
    </style>
    <script>
        jQuery(function() {
        jQuery("#submit").click(function() {
            var nick = jQuery('#nick').val();
            jQuery('#submit').attr('disabled', 'disabled');
            if (!nick) {
                jQuery('#nick').focus().addClass('error');
                return;
            }

            var error = function(resp) {
                var respText = resp.responseText ? resp.responseText.trim() : false;
                if (respText == 'NO_NICK') {
                    alert('Sorry, no such user exists');
                } else {
                    alert('Error sending request: ' + respText);
                }
                jQuery('#submit').removeAttr('disabled');
            };

            var success = function() {
                alert('Email sent!');
                location.href = "/";
            };

            jQuery.ajax({ type: 'POST',
                          timeout: 5000,
                          url: '/reset-request',
                          data: {'nick': nick },
                          success: success,
                          error: error });
        });
        });
    </script>
      <link rel="stylesheet" type="text/css" href="static/css/index.css">  
  </head>
  <body>

<div id="rapper">


<div id="main" align="center">

  <div id="passwordreset">
    <div id="logo-and-text">
      <a href="/"><img src="http://hump.fm/static/img/dumppixellarge3.png"></a>
        <div align="center">
        
        
      <div id="feedback" style="display: none; color: red; margin-bottom: 2em;"></div>
      <h1>Forgot your password?</h1>
      <br>
      <div>
        Enter your nick and we'll email you the password reset stuff!
      </div>
      <br /><label style="display:none;">nick:</label>
      <input type="text" id="nick">
      <br />
      <input type="submit" value="Reset password" id="submit">
    </div></div></div></div>
  </body>
</html>