def signup(): if request.method == "GET": return render_template("auth/signup.html") if request.method == "POST": name = request.form["name"] email = request.form["email"] role = request.form["role"] password = request.form["password"] confirm_password = request.form["confirm_password"] if not name or not email or not role or not password or not confirm_password: return render_template( "auth/signup.html", error="Please, fill all the inputs." ) if not validate_name(name): return render_template( "auth/signup.html", error="Name should be at least 3 characters long." ) if password != confirm_password: return render_template("auth/signup.html", error="Passwords do not match.") if not validate_password(password): return render_template( "auth/signup.html", error="Password should contain at least 8 characters, at least 1 letter and 1 number.", ) if users.signup(name, email, role, password): return redirect("/login") else: return render_template( "auth/signup.html", error="Registration did not succeed." )
def signup(): if request.method == "GET": return render_template("signup.html") if request.method == "POST": errormessage = "" username = request.form["username"] if len(username) < 1: errormessage = "Rekisteröinti ei onnistunut. Käyttäjänimi ei saa olla tyhjä" password = request.form.getlist("password") if len(password[0]) < 1: errormessage = "Rekisteröinti ei onnistunut. Salasana ei saa olla tyhjä" if password[0] != password[1]: errormessage = "Rekisteröinti ei onnistunut. Salasanat eivät täsmää." role = request.form["role"] if role != "1" and role != "2": errormessage = "Rekisteröinti ei onnistunut. Tuntematon rooli." if len(errormessage) > 0: return render_template("signup.html", errormessage=errormessage) if users.signup(username, password[0], role): return redirect("/") else: return render_template("signup.html", errormessage="Rekisteröinti ei onnistunut. Valitse toinen käyttäjätunnus.")
def signup(): if request.method == "GET": return render_template("signup.html", error=False) if request.method == "POST": error = False message = "" username = request.form["username"] password = request.form["password"] if len(username) > 30: error = True message = "Käyttäjänimi on liian pitkä (max 30 merkkiä)" elif len(password) < 6: error = True message = "Salasanan on oltava vähintään 6 merkkiä" elif users.username_taken(username): error = True message = "Käyttäjänimi on jo käytössä" elif password != request.form["passcheck"]: error = True message = "Salasanat eivät täsmää" if error: return render_template("signup.html", error=True, message=message) if users.signup(username, password): return redirect("/login") else: message = "Rekisteröinti ei onnistunut" return render_template("signup.html", error=True, message=message)
def signup(): session['user_name'] = None session['user_id'] = None if request.method == 'POST': ok, message = users.signup(db, request.form.get('name'), request.form.get('password'), request.form.get('retype')) if ok: session['user_id'] = message session['user_name'] = request.form.get('name') return render_template('book_search.html', user_name=session['user_name'], title='', author='', year='', isbn='', books=[]) else: return render_template('signup.html', message=message, name=request.form.get('name'), password=request.form.get('password'), retype=request.form.get('retype')) else: return render_template('signup.html', message='', name='', password='', retype='')
def signup(): username = request.form["username"].strip() password = request.form["password"].strip() if not username or len(password) < 8: return render_template("signupform.html", signup_error=True) if users.signup(username, password): return render_template("signupform.html", signup_error=False) else: return render_template("signupform.html", username_duplicate=True)
def signup(): if request.method == 'POST': ok, message = users.signup(db_users, request.form.get('name'), request.form.get('password'), request.form.get('retype')) if ok: return render_template('list_channels.html', curr_username=request.form.get('name'), channels=db_channels.keys()) else: return render_template('signup.html', message=message, name=request.form.get('name'), password=request.form.get('password'), retype=request.form.get('retype')) else: return render_template('signup.html', message='', name='', password='', retype='')
def signup(): if request.method == "GET": return render_template("signup.html") if request.method == "POST": email = request.form['email'] password = request.form['password'] flash( email ) #users.signup(email, password) #return users.check_unicode(email) if users.signup(email, password): user = User(email, password, True) login_user(user, remember=False, force=False) flash("Logged in successfuly.") id = user.get_id() session['username'] = email if (user.is_anonymous()): return "<p>The User is anonymous</p>" else: return redirect(url_for("index")) else: return "I'm sorry, but that username is already taken please try again with another username"