잉여개발기 (SPDV) пре 5 година
родитељ
комит
18bc27cf54
5 измењених фајлова са 20 додато и 7 уклоњено
  1. 10 1
      emergency_tool.py
  2. 2 2
      route/login.py
  3. 5 1
      route/login_check_key.py
  4. 2 2
      route/user_setting.py
  5. 1 1
      version.json

+ 10 - 1
emergency_tool.py

@@ -134,6 +134,7 @@ print('12. All title count reset')
 print('13. Cache data reset')
 print('14. Delete Main <HEAD>')
 print('15. Give owner')
+print('16. Delete 2FA password')
 
 print('----')
 print('Select : ', end = '')
@@ -284,12 +285,20 @@ elif what_i_do == '13':
     curs.execute(db_change('delete from cache_data'))
 elif what_i_do == '14':
     curs.execute(db_change('delete from other where name = "head"'))
-else:
+elif what_i_do == '15':
     print('----')
     print('User name : ', end = '')
     user_name = input()
 
     curs.execute(db_change("update user set acl = 'owner' where id = ?"), [user_name])
+else:
+    print('----')
+    print('User name : ', end = '')
+    user_name = input()
+
+    curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [user_name])
+    if curs.fetchall():
+        curs.execute(db_change("update user_set set data = '' where name = '2fa' and id = ?"), [user_name])
 
 conn.commit()
 

+ 2 - 2
route/login.py

@@ -34,8 +34,8 @@ def login_2(conn):
             return re_error('/error/10')
 
         curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [user_id])
-        fa_data_pw = curs.fetchall()
-        if fa_data_pw:
+        fa_data = curs.fetchall()
+        if fa_data and fa_data[0][0] != '':
             curs.execute(db_change("select css from custom where user = ?"), [user_id])
             css_data = curs.fetchall()
             flask.session['b_head'] = css_data[0][0] if css_data else ''

+ 5 - 1
route/login_check_key.py

@@ -21,10 +21,14 @@ def login_check_key_2(conn, tool):
                 curs.execute(db_change('select data from other where name = "reset_user_text"'))
                 sql_d = curs.fetchall()
                 if sql_d and sql_d[0][0] != '':
-                    b_text = sql_d[0][0] + '<hr class=\"main_hr\">'
+                    b_text = sql_d[0][0] + '<hr class="main_hr">'
                 else:
                     b_text = ''
 
+                curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [d_id])
+                if curs.fetchall():
+                    curs.execute(db_change("update user_set set data = '' where name = '2fa' and id = ?"), [d_id])
+
                 return easy_minify(flask.render_template(skin_check(),
                     imp = [load_lang('reset_user_ok'), wiki_set(), custom(), other2([0, 0])],
                     data = b_text + load_lang('id') + ' : ' + d_id + '<br>' + load_lang('password') + ' : ' + pw,

+ 2 - 2
route/user_setting.py

@@ -67,9 +67,9 @@ def user_setting_2(conn, server_init):
             fa_data = curs.fetchall()
             fa_data = 'checked' if fa_data and fa_data[0][0] != '' else ''
 
-            curs.execute(db_change('select data from user_set where name = "2fa" and id = ?'), [ip])
+            curs.execute(db_change('select data from user_set where name = "2fa_pw" and id = ?'), [ip])
             fa_data_pw = curs.fetchall()
-            fa_data_pw = load_lang('2fa_password_change') if fa_data else load_lang('2fa_password')
+            fa_data_pw = load_lang('2fa_password_change') if fa_data_pw else load_lang('2fa_password')
             
             http_warring = '' + \
                 '<hr class="main_hr">' + \

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "master" : {
-        "r_ver" : "v3.2.0-master-21 (v3.2.0-dev-20200806-02)",
+        "r_ver" : "v3.2.0-master-21 (v3.2.0-dev-20200806-03)",
         "c_ver" : "3201601",
         "s_ver" : "9"
     }, "stable" : {