Esempio n. 1
0
def register(request):
    if request.method == "GET":
        return render(request, 'register.html')

    elif request.method == "POST":
        username = request.POST.get("username")
        password = request.POST.get("password")
        email = request.POST.get("email")

        user = User()
        user.username = username
        user.password = password
        user.email = email
        user.save()
        return render(request, "register_success.html")
Esempio n. 2
0
def register(request):
    if request.method == 'GET':
        return render(request,'mine/register.html')
    elif request.method == 'POST':
        user = User()
        user.email = request.POST.get('email')
        user.password = generate_password(request.POST.get('password'))
        user.name = request.POST.get('name')
        user.phone = request.POST.get('phone')

        # 状态保持
        user.token = generate_token()
        user.save()
        request.session['token'] = user.token
        return redirect('axf:mine')
Esempio n. 3
0
def register():
    if request.method == 'GET':
        return render_template('user/register.html')
    if request.method == 'POST':
        username = request.form.get('username')
        email = request.form.get('email')
        password = request.form.get('password')
        re_password = request.form.get('re_password')
        if all([username, password, re_password]):
            if password == re_password:
                user = User()
                user.username = username
                user.password = password
                user.email = email

                db.session.add(user)
                db.session.commit()

                return redirect(url_for('user.login'))
        return render_template('user/register.html')
Esempio n. 4
0
def api_user_register():
    userInfo = request.get_json()['params']
    print(userInfo)
    name = userInfo['studentName']
    email = userInfo['email']
    mobile = userInfo['mobile']
    password_md5 = userInfo['password']
    studentNumber = userInfo['studentNumber']
    print(email, mobile, password_md5, studentNumber)

    # ------------------------------------#
    # sql
    reader = User()
    reader.sno = studentNumber
    reader.name = name
    reader.password = password_md5
    reader.phone = mobile
    reader.email = email
    db.session.add(reader)
    db.session.commit()
    # ------------------------------------#
    return 'success'