def register(): database = client.userdb collection = database.usercol if request.method == "GET": return render_template("register.html") else: username = request.form["username"].encode("ascii", "ignore") password = request.form["password"].encode("ascii", "ignore") if request.form["button"] == "Submit": if auth.exists(username): return render_template("success.html", username=username) else: auth.adduser(username, password) return render_template("login.html") else: return render_template("register.html")
def register(): if request.method == "GET": return render_template("register.html", invalid="False", repeat="False") else: usernameu = request.form['username'] username = usernameu.encode('ascii', 'ignore') passwordu = request.form['password'] password = passwordu.encode('ascii', 'ignore') passwordretypeu = request.form['passwordretype'] passwordretype = passwordretypeu.encode('ascii', 'ignore') if password == passwordretype: if adduser(username, password): session['username'] = username return redirect(url_for('home')) else: return render_template("register.html", invalid="False", repeat="True") else: return render_template("register.html", invalid="True", repeat="False")
def register(): database = client.userdb collection = database.usercol if request.method=="GET": return render_template("register.html") else: username=request.form["username"].encode("ascii","ignore") password=request.form["password"].encode("ascii","ignore") if request.form["button"]=="Submit": if auth.exists(username): return render_template("success.html",username=username) else: auth.adduser(username,password) return render_template("login.html") else: return render_template("register.html")
def Register(): if "Username" in session: return redirect(url_for("Home")) elif request.method == "GET": return render_template("Register.html") elif request.method == "POST": User = request.form["Username"] if not auth.authenticate(User, request.form['Password']): auth.adduser(User, request.form["Password"]) session["Username"] = User #Database = shelve.get_shelve() #if Username in Database: # return render_template("Register.html") #else: # Database[Username] = Password return redirect(url_for("Home"))
def register(): database = sqlite3.connect('names.db') database.execute(''' CREATE TABLE if not exists user(username text, password text) ''') if request.method == "GET": return render_template("register.html") else: username = request.form["username"].encode("ascii", "ignore") password = request.form["password"].encode("ascii", "ignore") if request.form["button"] == "Submit": if auth.exists(username): return render_template("success.html", username=username) else: auth.adduser(username, password) return render_template("register.html") else: return render_template("register.html")
def register(): database = sqlite3.connect('names.db') database.execute(''' CREATE TABLE if not exists user(username text, password text) ''') if request.method=="GET": return render_template("register.html") else: username=request.form["username"].encode("ascii","ignore") password=request.form["password"].encode("ascii","ignore") if request.form["button"]=="Submit": if auth.exists(username): return render_template("success.html",username=username) else: auth.adduser(username,password) return render_template("register.html") else: return render_template("register.html")
def register(): if request.method == 'GET': return render_template("register.html",error="") elif request.method == 'POST': user = request.form['user'].encode('ascii','ignore') pw = request.form['pass'].encode('ascii','ignore') if adduser(user, pw): return redirect(url_for('login')) else: return render_template("register.html",error="Username already exists")
def register(): if request.method == 'GET': return render_template("register.html", error="") elif request.method == 'POST': user = request.form['user'].encode('ascii', 'ignore') pw = request.form['pass'].encode('ascii', 'ignore') if adduser(user, pw): return redirect(url_for('login')) else: return render_template("register.html", error="Username already exists")
def register(): if "username" in session: return redirect("home") elif request.method == "GET": return render_template("register.html", message = "") else: user = request.form["user"].encode("utf8") pw = request.form["pass"].encode("utf8") if adduser(user, pw): return redirect("login") else: return render_template("register.html", message = "Username already taken.")
def register(): if "username" in session: return redirect("home") elif request.method == "GET": return render_template("register.html", message="") else: user = request.form["user"].encode("utf8") pw = request.form["pass"].encode("utf8") if adduser(user, pw): return redirect("login") else: return render_template("register.html", message="Username already taken.")
def register(): if 'user' in session: return redirect(url_for('home')) elif request.method == "GET": return render_template("register.html", message = "") else: button = request.form['button'].encode("utf8") if button == "Register": if auth.adduser(request.form['user'], request.form['pass']) == True: return redirect(url_for('home')) else: return render_template("register.html", message = "User exists already. Please login.") else: return redirect(url_for('login'))
def adduser(clicks, username, email, current_state): #print('adduser() triggered') if clicks > 0: adduser_code = auth.adduser(username.lower(), email.lower()) if adduser_code == 0: #print('adduser success') return '/adduser_success' else: #print('adduser failed:', adduser_code) if adduser_code == 1: return '/adduser_failure1' elif adduser_code == 2: return '/adduser_failure2' else: return current_state
def register(): if 'user' in session: return redirect(url_for('home')) elif request.method == "GET": return render_template("register.html", message="") else: button = request.form['button'].encode("utf8") if button == "Register": if auth.adduser(request.form['user'], request.form['pass']) == True: return redirect(url_for('home')) else: return render_template( "register.html", message="User exists already. Please login.") else: return redirect(url_for('login'))
def register(): if request.method == "GET": return render_template("register.html",invalid="False",repeat="False") else : usernameu = request.form['username'] username = usernameu.encode('ascii','ignore') passwordu = request.form['password'] password = passwordu.encode('ascii','ignore') passwordretypeu = request.form['passwordretype'] passwordretype = passwordretypeu.encode('ascii','ignore') if password == passwordretype: if adduser(username, password): session['username'] = username return redirect(url_for('home')) else: return render_template("register.html",invalid="False",repeat="True") else: return render_template("register.html",invalid="True",repeat="False")