def user_import(): try: name = request.args.get('name') password = request.args.get('password') user = User(name, password) user.input_user() return user.name except Exception as e: logging.exception(f"Exception [{e}]: while adding user") return make_response("Unprocessable entity", 430)
def signup(): if request.method == 'GET': return render_template('sign_up.html') username = request.form.get('user') password1 = request.form.get('password1') password2 = request.form.get('password2') user = User(username, password1) if password1 != password2: flash('Password must match', category='error') return render_template("sign_up.html") success = user.input_user() if not success: flash("User must have atleast 3 chars, password 4.", category='error') return render_template("sign_up.html") token = user.get_encoded_token() return render_template('user.html', user=user.name, token=token)