Example #1
0
def apiregister():
    #save registration details to database
    #firstname= request.json["firstName"]
    lastname= request.json["lastName"]
    username= request.json["userName"]
    password= request.json["password"]
    email_address=request.json["email"]
    pword_hint=request.json["hint"]
    message =""
    m = {message: "it worked"}
    
    user=  WishersInfo(first_name=firstname, last_name=lastname, username=username, password= password, email_address = email_address, pword_hint = pword_hint)
    db.session.add(user)
    db.session.commit()
    
    
        "id"=us
def add_user():
    
    """Render the website's add user page."""
    if request.method == 'POST':
        firstname= request.form['firstname']
        lastname= request.form['lastname']
        username= request.form['username']
        email=request.form['email']
        p_hint=request.form['hint']
        password= hash(request.form['password']+str("i am a not so secret salt"))
        user= WishersInfo(first_name=firstname, last_name=lastname, username=username, password= password, email_address=email, pword_hint=p_hint)
        db.session.add(user)
        db.session.commit()
        login_user(user)
        flash('Account created successfully.','success')
        return redirect(url_for("wishers_page"))
    
    
    return render_template('home.html')