예제 #1
0
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')
예제 #2
0
    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")
예제 #3
0
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
예제 #4
0
 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
예제 #5
0
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')
예제 #6
0
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')
예제 #7
0
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')