def register(): if "user" in session: flash("You're already logged in! If you want to register for another account, please logout first") return render_template('home.html') if request.method=='GET': return render_template("register.html") else: user = request.form["user"] pwrd = request.form["pwrd"] if (not(db.legitLogin(user,pwrd))): flash("Invalid username or password") redirect("/login") elif (db.existingUser(user)==False): flash("That username is already taken, try another one") redirect("/login") else: user = request.form["user"] pwrd = request.form["pwrd"] ##name = request.form["name"] if (not(db.legitLogin(user,pwrd))): flash("Invalid username or password") redirect("/register") elif (db.existingUser(user)): flash("That username is already taken, try another one") redirect("/register") else: db.user.insert({"user":user, "pwrd":pwrd, "name":name}) redirect("/login") db.registerUser(user,pwrd) flash("You have succesfully created a new account! Please log in to continue") return redirect('/login')
def signup(id): token = random.randint(0, 9999) try: db.createUserTable(id) db.registerUser(id, token) except Exception as e: print(token) print(e) raise AppExceptions.UserAlreadyExist("AppExceptions.UserAlreadyExist")
def register(): if "user" in session: flash("Please logout first to register another account!") return render_template('home.html',name=db.getName(session['user'])) if request.method=='GET': return render_template('register.html') else: name=request.form['name'] user=request.form['user'] pw=request.form['pass'] color=request.form['color'] if name == "" or user == "" or pw =="" or color == "": flash('Please fill in all the fields') return redirect('/register') elif db.existingName(user)== False: flash('Your username is already taken!') return redirect('/register') else: if db.registerUser(user,name,color,pw): return redirect('/login') else: return redirect('/about') ##should be replaced with flash
def post(self): user_data = User.user_parser.parse_args() print('=' * 50) print(user_data) print('=' * 50) user_add_data = User.user_add_parser.parse_args() return db.registerUser(user_data, user_add_data), 201
def register(): if "user" in session: flash( "You're already logged in! If you want to register for another account, please logout first" ) return render_template('home.html') if request.method == 'GET': return render_template("register.html") else: user = request.form["user"] pwrd = request.form["pwrd"] if (not (db.legitLogin(user, pwrd))): flash("Invalid username or password") redirect("/login") elif (db.existingUser(user) == False): flash("That username is already taken, try another one") redirect("/login") else: user = request.form["user"] pwrd = request.form["pwrd"] ##name = request.form["name"] if (not (db.legitLogin(user, pwrd))): flash("Invalid username or password") redirect("/register") elif (db.existingUser(user)): flash("That username is already taken, try another one") redirect("/register") else: db.user.insert({"user": user, "pwrd": pwrd, "name": name}) redirect("/login") db.registerUser(user, pwrd) flash( "You have succesfully created a new account! Please log in to continue" ) return redirect('/login')
def register(): seed = password_Entry.get() h = hashlib.sha256(seed.encode()) check = registerUser(user_Entry.get(), h.hexdigest()) if check: messagebox.showinfo('Registro', 'Registro efectuado') user_Entry.delete(0, 'end') password_Entry.delete(0, 'end') else: messagebox.showinfo('Registro', 'El usuario ya existe') user_Entry.delete(0, 'end') password_Entry.delete(0, 'end')
def registerPost(response): user = {} user['name'] = response.get_field("name") user['email'] = response.get_field("email") user['password'] = response.get_field("password1") user['usertype'] = response.get_field("usertype") register = db.registerUser(dbConn, user) # register successful go to homepage/login print register if register == 1: print "registration succesful" mailPoVo.sendConfirmationEmail(user['email'], user['name']) response.redirect('/login') # register failed go back to register elif register == 2: response.redirect('/register?fail=userExist') else: response.redirect('/register?fail=error')