File size: 3,582 Bytes
08c964e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{% extends "layout.html" %}
{% block content %}
<style type="text/css">
  .modify_password {
    background-color: #fff;
    margin: 15px;
    min-height: 500px;
  }

  .modify_password .bt-form {
    width: 380px;
  }

  .modify_password .header {
    font-size: 19px;
    margin-bottom: 15px;
  }

  .modify_password .bt-input-text {
    height: 40px !important;
    line-height: 40px !important;
    border-radius: 2px;
    width: 100% !important;
    font-size: 14px;
  }

  .modify_password_btn {
    width: 340px;
    height: 40px;
    background: #20a53a;
    background: linear-gradient(#20a53a, #189d32);
    box-shadow: inset 0 1px 2px #30ad42;
    color: #fff;
    text-shadow: #00851a 0 -1px 0;
    border: 1px solid #20a53a;
    text-align: center;
    font-size: 14px;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
  }

  .random_paw {
    position: absolute;
    top: 10px;
    right: 5px;
  }

  .bt-form {
    position: absolute;
    top: 120px;
    left: 50%;
    margin-left: -150px;
    padding: 40px 20px;
  }

  .bt-form .line {
    position: relative;
  }

  .bt-form input {
    margin-bottom: 10px;
  }
</style>
<div class="main-content pb55" style="min-height: 525px;">
  <div class="container-fluid modify_password">
    <div class="bt-form" style="text-align: center;">
      <span class="header" style="">当前面板密码已过期,请立即修改密码!</span>
      <div class="line" style="margin-top: 15px;">
        <input class="bt-input-text" type="text" name="password1" id="p1" value="" placeholder="新的密码"
               style="width:300px">
        <span title="随机密码" class="btn btn-success btn-sm random_paw" onclick="randPwd(16)">随机密码</span>
      </div>
      <div class="line">
        <input class="bt-input-text" type="text" name="password2" id="p2" value="" placeholder="重复输入密码,确认新的密码"
               style="width:300px">
      </div>
      <div>
        <button type="button" class="btn btn-success btn-sm modify_password_btn"
                onclick="modify_password()">修改密码</button>

      </div>
      <div style="margin-top: 10px;float: right;">
        <a class="btlink" >延用上一次密码</a>
      </div>

    </div>
  </div>
</div>
{% endblock %}
{% block scripts %}
{{ super() }}
<script type="text/javascript">
  $('.btlink').click(function () {
    var id = layer.confirm('延用上次密码会降低面板的'+'<span style="color: red">安全性</span>'+',是否继续?', {
      icon: 3, title: '危险操作', closeBtn: 2, btn: ['确定', '取消'],
    }, function () {
      bt_tools.send('config?action=setlastPassword',function (rdata){
        bt_tools.msg(rdata)
        location.href = "/"
      })
      layer.close(id)

    }, function () {
      layer.close(id)
    })
  })
  function modify_password() {
    p1 = $("#p1").val();
    p2 = $("#p2").val();
    if (p1 == "" || p1.length < 8) {
      layer.msg(lan.bt.pass_err_len, {
        icon: 2
      });
      return
    }

    var pdata = {
      password1: rsa.encrypt_public(p1),
      password2: rsa.encrypt_public(p2)
    };

    $.post("/config?action=setPassword", pdata,
            function (b) {
              if (b.status) {
                layer.msg(b.msg, {
                  icon: 1
                });
                window.location.href = '/login?dologin=True';
              } else {
                layer.msg(b.msg, {
                  icon: 2,
                  time: 8000
                })
              }
            });
  }
</script>

{%endblock %}