Browse Source

Add default email whitelist when empty

LiteHell 6 years ago
parent
commit
3aef84a2ab
2 changed files with 6 additions and 2 deletions
  1. 5 0
      app.py
  2. 1 2
      route/login_need_email.py

+ 5 - 0
app.py

@@ -321,6 +321,11 @@ curs.execute(db_change('select data from other where name = "count_all_title"'))
 if not curs.fetchall():
     curs.execute(db_change('insert into other (name, data) values ("count_all_title", "0")'))
 
+curs.execute(db_change("select html from html_filter where kind = 'email'"))
+if not curs.fetchall():
+    for i in ['naver.com', 'gmail.com', 'daum.net', 'kakao.com']:
+        curs.execute(db_change("insert into html_filter (html, kind) values (?, 'email')"), [i])
+
 conn.commit()
 
 if os.path.exists('custom.py'):

+ 1 - 2
route/login_need_email.py

@@ -39,13 +39,12 @@ def login_need_email_2(conn, tool):
                 flask.session['c_pw'] = ''
 
             if 'c_id' in flask.session:
-                main_email = []
                 data = re.search('@([^@]+)$', flask.request.form.get('email', ''))
                 if data:
                     data = data.groups()[0]
 
                     curs.execute(db_change("select html from html_filter where html = ? and kind = 'email'"), [data])
-                    if curs.fetchall() or (data in main_email):
+                    if curs.fetchall():
                         curs.execute(db_change('select id from user_set where name = "email" and data = ?'), [flask.request.form.get('email', '')])
                         if curs.fetchall():
                             flask.session.pop('c_id', None)