def register_user(): username = request.values.get("username", None) password = request.values.get("password", None) #log.debug(username) if username is None or password is None: return jsonify({ "status": -3, "msg": "username or password error" }), 400 if RegisterUser.verify_username(username) == False: return jsonify({"status": -3, "msg": "username already exists"}) user_info = {"username": username, "password": password} log.debug(user_info) if RegisterUser.register(user_info): user = User(RegisterUser.get_id(username)) return jsonify({ "username": username, "msg": "Registered Successfully", "status": 0 }) return jsonify({ "username": username, "msg": "Registration failed", "status": -2 })
def signup(): username = request.form.get("username", None) password = request.form.get("firstPassword", None) email = request.form.get("signupEmail", None) captcha = request.form.get("captcha", None) user_info = { "username": username, "password": password, "email": email, "captcha": captcha } captcha_obj = Captcha() if (captcha_obj.verify_captcha(email, captcha)): RegisterUser.register(user_info) return redirect(request.args.get('next') or url_for("main.home")) else: return jsonify({"result": 0})