Beispiel #1
0
def create_fuser_post():
    for x in range(21, 40):
        username = '******' % x
        tel = create_phone()
        password = create_phone()
        email = create_phone() + '@qq.com'
        fuser = FrontUser(username=username,
                          tel=tel,
                          password=password,
                          email=email)
        db.session.add(fuser)
        db.session.commit()
    print('恭喜!测试用户添加成功!')
Beispiel #2
0
 def post(self):
     fm = SignupFrom(formdata=request.form)  #验证用户输入的内容(用户名是否重复,验证码是否正确等等)
     if fm.validate():
         u = FrontUser(
             telephone=fm.telephone.data,  #如果通过验证则往数据库里添加即可
             username=fm.username.data,
             password=fm.password.data)
         db.session.add(u)
         db.session.commit()
         delete(fm.telephone.data)  # 注册成功,删除手机验证码
         return jsonify(respSuccess("注册成功"))
     else:
         return jsonify(respParamErr(fm.err))
Beispiel #3
0
 def post(self):
     fm = SignupFrom(formdata=request.form)
     if fm.validate():
         # 把这个用户保存到数据库中
         u = FrontUser(telephone=fm.telephone.data,
                       username=fm.username.data,
                       password=fm.password.data)
         db.session.add(u)
         db.session.commit()
         delete(fm.telephone.data)
         return jsonify(respSuccess("账号注册成功"))
     else:
         return jsonify(respParamErr(fm.err))
Beispiel #4
0
 def post(self):
     form = SignupForm(request.form)
     if form.validate():
         telephone = form.telephone.data
         username = form.username.data
         password = form.password1.data
         user = FrontUser(telephone=telephone,
                          username=username,
                          password=password)
         db.session.add(user)
         db.session.commit()
         return restful.success()
     else:
         return restful.params_error(message=form.get_error())
Beispiel #5
0
    def post(self):
        form = SignupForm(request.form)

        if form.validate():
            # telephone = form.telephone.data
            username = form.username.data
            password = form.password.data
            user = FrontUser(username=username, password=password)
            db.session.add(user)
            db.session.commit()

            return jsonify({'code': '200', 'message': '用户注册成功!'})
        else:
            message = form.errors.popitem()[1][0]

            # 表单验证错误(数据格式不对)
            return jsonify({'code': '400', 'message': message})
Beispiel #6
0
def create_front_user(telephone, password, username):
    user = FrontUser(telephone=telephone, password=password, username=username)
    db.session.add(user)
    db.session.commit()
Beispiel #7
0
def create_front_user(telephone, username, password):
    user = FrontUser(telephone=telephone, username=username, password=password)
    db.session.add(user)
    db.session.commit()
    print('成功创建前台用户:{}'.format(username))
Beispiel #8
0
def create_front_user(telephone, username, password):
    user = FrontUser(telephone=telephone, username=username, password=password)
    db.session.add(user)
    db.session.commit()
    print("前台用户添加成功")
Beispiel #9
0
def create_front_user(username, password, tel):
    user = FrontUser(username=username, password=password, tel=tel)
    db.session.add(user)
    db.session.commit()
    print('前台用户添加成功')