summaryrefslogtreecommitdiff
path: root/template/reset.st
blob: f166d8870d1b566ba50d2f44ef989063f34c883a (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
<html>
  <head>
    <title>dump.fm Password Reset</title>
    <script type="text/javascript" src="/static/js/sha1.js"></script>
    $head()$
    <style>
      #main {      
      padding: 100px 2em 0px 2em;
      }
      label {
          float: left;
          width: 150px;
      }
    </style>
    <script>
        jQuery(function() {
        jQuery("#submit").click(function() {
            var p1 = jQuery('#p1').val();
            var p2 = jQuery('#p1').val();
            if (p1.length < 5) {
                jQuery('#feedback').text("Password must be at least five letters long!").show();
                jQuery('#p1, #p2').val("");
                return false;
            } else if (p1 != p2) {
                jQuery('#feedback').text("Both passwords must match!").show();
                jQuery('#p1, #p2').val("");
                return false;
            }
            var nick = '$nick$';
            var hash = hex_sha1(nick + '\$' + p1 + '\$dumpfm');
            jQuery('#hash').val(hash);
            return true;
        });
        });
    </script>
  </head>
  <body>
    $banner()$
    <div id="main">
      $if(valid_request)$
      <div id="feedback" style="display: none; color: red; margin-bottom: 2em;"></div>
      <h1>Reset Your Password</h1>
      <br>
      <label>New Password:</label>
      <input type="password" id="p1">
      <br>
      <label>Repeat Password:</label>
      <input type="password" id="p2">
      <br>
      <form action="$link$" method="POST">
        <input type="hidden" value="hash" name="hash" id="hash">
        <input type="submit" value="Change password" id="submit">
      </form>
      $else$
      <h1>Bad Request</h1>
      <span>Your password reset link is invalid or has expired. Please try
        resetting again.</span>
      $endif$
    </div>
  </body>
</html>