|
@@ -47,12 +47,28 @@ def login_register_2(conn):
|
|
|
|
|
|
|
|
hashed = pw_encode(flask.request.form.get('pw', None))
|
|
hashed = pw_encode(flask.request.form.get('pw', None))
|
|
|
|
|
|
|
|
|
|
+ curs.execute(db_change('select data from other where name = "requires_approval"'))
|
|
|
|
|
+ requires_approval = curs.fetchall()
|
|
|
|
|
+ requires_approval = requires_approval and requires_approval[0][0] == 'on'
|
|
|
|
|
+
|
|
|
|
|
+ approval_question = ''
|
|
|
|
|
+ if requires_approval:
|
|
|
|
|
+ curs.execute(db_change('select data from other where name = "approval_question"'))
|
|
|
|
|
+ approval_question = curs.fetchall()
|
|
|
|
|
+ if approval_question and approval_question[0][0]:
|
|
|
|
|
+ approval_question = approval_question[0][0]
|
|
|
|
|
+ else:
|
|
|
|
|
+ approval_question = ''
|
|
|
|
|
+
|
|
|
curs.execute(db_change('select data from other where name = "email_have"'))
|
|
curs.execute(db_change('select data from other where name = "email_have"'))
|
|
|
sql_data = curs.fetchall()
|
|
sql_data = curs.fetchall()
|
|
|
if sql_data and sql_data[0][0] != '':
|
|
if sql_data and sql_data[0][0] != '':
|
|
|
flask.session['c_id'] = flask.request.form.get('id', None)
|
|
flask.session['c_id'] = flask.request.form.get('id', None)
|
|
|
flask.session['c_pw'] = hashed
|
|
flask.session['c_pw'] = hashed
|
|
|
flask.session['c_key'] = ''.join(random.choice("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") for i in range(16))
|
|
flask.session['c_key'] = ''.join(random.choice("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") for i in range(16))
|
|
|
|
|
+ if requires_approval:
|
|
|
|
|
+ flask.session['c_ans'] = flask.request.form.get('approval_question_answer')
|
|
|
|
|
+ flask.session['c_question'] = approval_question
|
|
|
|
|
|
|
|
return redirect('/need_email')
|
|
return redirect('/need_email')
|
|
|
else:
|
|
else:
|
|
@@ -65,7 +81,13 @@ def login_register_2(conn):
|
|
|
|
|
|
|
|
first = 1
|
|
first = 1
|
|
|
else:
|
|
else:
|
|
|
- curs.execute(db_change("insert into user (id, pw, acl, date, encode) values (?, ?, 'user', ?, ?)"), [flask.request.form.get('id', None), hashed, get_time(), db_data[0][0]])
|
|
|
|
|
|
|
+ if requires_approval:
|
|
|
|
|
+ application_token = ''.join(random.choice("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") for i in range(60))
|
|
|
|
|
+ curs.execute(db_change("insert into user_application (id, pw, date, encode, question, answer, token, ip, ua, email) values (?, ?, ?, ?, ?, ?, ?, ?, ?, '')"), [flask.request.form.get('id', None), hashed, get_time(), db_data[0][0], approval_question, flask.request.form.get('approval_question_answer', None), application_token, ip_check(), flask.request.headers.get('User-Agent')])
|
|
|
|
|
+ conn.commit()
|
|
|
|
|
+ return redirect('/application_submitted')
|
|
|
|
|
+ else:
|
|
|
|
|
+ curs.execute(db_change("insert into user (id, pw, acl, date, encode) values (?, ?, 'user', ?, ?)"), [flask.request.form.get('id', None), hashed, get_time(), db_data[0][0]])
|
|
|
|
|
|
|
|
first = 0
|
|
first = 0
|
|
|
|
|
|
|
@@ -94,6 +116,23 @@ def login_register_2(conn):
|
|
|
|
|
|
|
|
http_warring = '<hr class=\"main_hr\"><span>' + load_lang('http_warring') + '</span>'
|
|
http_warring = '<hr class=\"main_hr\"><span>' + load_lang('http_warring') + '</span>'
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ approval_question = ''
|
|
|
|
|
+
|
|
|
|
|
+ curs.execute(db_change('select data from other where name = "requires_approval"'))
|
|
|
|
|
+ requires_approval = curs.fetchall()
|
|
|
|
|
+ requires_approval = requires_approval and requires_approval[0][0] == 'on'
|
|
|
|
|
+ if requires_approval:
|
|
|
|
|
+ curs.execute(db_change('select data from other where name = "approval_question"'))
|
|
|
|
|
+ data = curs.fetchall()
|
|
|
|
|
+ if data and data[0][0] != '':
|
|
|
|
|
+ approval_question = '''<hr class=\"main_hr\">
|
|
|
|
|
+ <span>''' + load_lang('approval_question') + ' : ' + data[0][0] + '''<span>
|
|
|
|
|
+ <hr class=\"main_hr\">
|
|
|
|
|
+ <input placeholder="''' + load_lang('approval_question') + '''" name="approval_question_answer" type="text">
|
|
|
|
|
+ <hr class=\"main_hr\">
|
|
|
|
|
+ '''
|
|
|
|
|
+
|
|
|
return easy_minify(flask.render_template(skin_check(),
|
|
return easy_minify(flask.render_template(skin_check(),
|
|
|
imp = [load_lang('register'), wiki_set(), custom(), other2([0, 0])],
|
|
imp = [load_lang('register'), wiki_set(), custom(), other2([0, 0])],
|
|
|
data = '''
|
|
data = '''
|
|
@@ -105,6 +144,7 @@ def login_register_2(conn):
|
|
|
<hr class=\"main_hr\">
|
|
<hr class=\"main_hr\">
|
|
|
<input placeholder="''' + load_lang('password_confirm') + '''" name="pw2" type="password">
|
|
<input placeholder="''' + load_lang('password_confirm') + '''" name="pw2" type="password">
|
|
|
<hr class=\"main_hr\">
|
|
<hr class=\"main_hr\">
|
|
|
|
|
+ ''' + approval_question + '''
|
|
|
''' + captcha_get() + '''
|
|
''' + captcha_get() + '''
|
|
|
<button type="submit">''' + load_lang('save') + '''</button>
|
|
<button type="submit">''' + load_lang('save') + '''</button>
|
|
|
''' + http_warring + '''
|
|
''' + http_warring + '''
|