Example #1
0
def main():
    user = None
    if 'uid' in session:
        uid = session['uid']
        user_model = UserModel(app.config['MYSQL_AGENT'])
        user = user_model.query_user('userid', uid, ['email', 'userid', 'nickname'])
    return render_template('index.html', user=user)
Example #2
0
def main():
    user = None
    if 'uid' in session:
        uid = session['uid']
        user_model = UserModel(app.config['MYSQL_AGENT'])
        user = user_model.query_user('userid', uid,
                                     ['email', 'userid', 'nickname'])
    return render_template('index.html', user=user)
Example #3
0
def dologin():
    email = request.form['email']
    passwd = request.form['password']
    user_model = UserModel(app.config['MYSQL_AGENT'])
    user = user_model.query_user('email', email, ['email', 'password', 'userid'])
    if user:
        session['uid'] = user['userid']
        return redirect('/')
    return "用户名不存在"
Example #4
0
def regist():
    if request.method == 'GET':
        return render_template("regist.tpl.html")
    user_model = UserModel(app.config['MYSQL_AGENT'])
    user_info = {'email' : request.form['email'],
             'nickname' : request.form['nickname'],
             'passwd' : request.form['password']
             }
    user = user_model.create_user(user_info)
    session['uid'] = user['userid']
    return redirect(url_for('/'))
Example #5
0
def regist():
    if request.method == 'GET':
        return render_template("regist.tpl.html")
    user_model = UserModel(app.config['MYSQL_AGENT'])
    user_info = {
        'email': request.form['email'],
        'nickname': request.form['nickname'],
        'passwd': request.form['password']
    }
    user = user_model.create_user(user_info)
    session['uid'] = user['userid']
    return redirect(url_for('/'))