Exemplo n.º 1
0
def myInfoUpdate(user_id):
    title = ddb + "Update My Info"
    myinfo = User.query.get_or_404(user_id)
    update_info = UserInfoForm()

    if myinfo.id != current_user.id:
        flash("You cannot update another users info")
        return redirect(url_for('myinfo'))

    if request.method == 'POST' and update_info.validate():
        username = update_info.username.data
        email = update_info.email.data
        password = update_info.password.data
        phone = update_info.phone.data
        address = update_info.address.data
        city = update_info.city.data
        zipcode = update_info.zipcode.data

        myinfo.username = username
        myinfo.email = email
        myinfo.password = generate_password_hash(password)
        myinfo.phone = phone
        myinfo.address = address
        myinfo.city = city
        myinfo.zipcode = zipcode

        db.session.commit()

        flash("You have successfully updated your info")
        return redirect(url_for('myinfo', user_id=current_user.id))
    return render_template('myInfoUpdate.html', title=title, form=update_info)
Exemplo n.º 2
0
def register():
    title = ddb + "register"
    form = UserInfoForm()
    if request.method == 'POST' and form.validate():
        username = form.username.data
        email = form.email.data
        password = form.password.data
        phone = form.phone.data
        address = form.address.data
        city = form.city.data
        zipcode = form.zipcode.data
        # admin = form.admin.data
        # print(username, email, password)

        # create new instance of User
        new_user = User(username, email, password,phone, address, city, zipcode)
        # add new instance to our database
        db.session.add(new_user)
        # commit database
        db.session.commit()

        # send email to new user
        msg = Message(f"Welcome, {username}", [email])
        msg.body = 'Thank you for signing up for the most glorious death of your bugs. I hope you enjoy your new carnage!'
        msg.html = "<p>Thanks you so much for signing up for the Dale's Dead Bugs service. Where we do buggin right! We may, or may not, be in Liberia!</p>"

        mail.send(msg) 

        flash("It may be a crack in your internet, or the Chinese are making their move!", "success")
        return redirect(url_for('index'))
    return render_template('register.html', title=title, form=form)
Exemplo n.º 3
0
def register():
    title = "Virtual Tour Mates | REGISTER"
    form = UserInfoForm()
    if request.method == 'POST' and form.validate():
        username = form.username.data
        email = form.email.data
        password = form.password.data
        # print(username, email, password)
        
        # create a new instance of User
        new_user = User(username, email, password)
        # add new instance to our database
        db.session.add(new_user)
        # commit database
        db.session.commit()

        # Send email to new user
        msg = Message(f'Welcome, {username}', [email])
        msg.body = "Thank you for signing up for the Virtual Tour Mates. I hope you enjoy our app!"
        msg.html = "<p>Thank you so much for signing up for the Virtual Tour Mates. I hope you enjoy our app!</p>"

        mail.send(msg)

        flash("You have succesfully signed up!", "success")
        return redirect(url_for('index'))
    return render_template('register.html', title=title, form=form)
Exemplo n.º 4
0
def register():
    title = 'Kekembas blog | REGISTER'
    form = UserInfoForm()
    

    if request.method == 'POST' and form.validate():
        username = form.username.data
        email = form.email.data
        password = form.password.data

        print(username,email, password)
        
        #create a new instance of User
        new_user = User(username,email,password)
        #add new instance of use
        db.session.add(new_user)
        #commit database
        db.session.commit()

        #SEND EMAIL TO NEW USER
        msg = Message(f"welcome, {username}", [email])
        msg.body = 'Thank you for siging up for the kekembas blog. I hope you enjoy our blog!'
        msg.html = '<p>Thank you so much for signing up for out blog!</p>'
        
        mail.send(msg)

        flash("You have succesfully signed up!", "success")
        return redirect(url_for('index'))

    return render_template('register.html', title=title,form=form)
Exemplo n.º 5
0
def register():
    title = 'Kekambas Blog | REGISTER'
    form = UserInfoForm()
    if request.method == 'POST' and form.validate():
        username= form.username.data
        email= form.email.data
        password= form.password.data
        # print(username, email, password)
        # create a new instance of User
        new_user= User(username, email, password)
        # add new instance of our database
        db.session.add(new_user)
        # commit database
        db.session.commit()
        # Send email to new user
        msg= Message(f'Welcome, {username}', [email])
        msg.body = 'Thank you for signing up for the Kekembas blog. I hope you enjoy our app!'
        msg.html = '<p> Thank you so much for signing up for the Kekemnbas blog. I hope you enjoy our app </p>'
        # send email

        mail.send(msg)

        flash('Welcome aboard!', 'success')
        return redirect(url_for("hello_world"))
    return render_template('register.html', title = title, form=form)
Exemplo n.º 6
0
def register():
    form = UserInfoForm()
    context = {'form': form}
    if request.method == 'POST' and form.validate():

        # Get Information
        username = form.username.data
        email = form.email.data
        password = form.password.data

        print(username, email, password)

        # Create new instance of User
        new_user = User(username, email, password)

        # Add user to db
        db.session.add(new_user)
        db.session.commit()

        # flash success message
        flash("You have successfully registered", 'success')

        # Flask Email Sender
        msg = Message(f'Thanks for signing up, {username}!',
                      recipients=[email])
        msg.body = ('Congrats on signing up! I hope you enjoy our site!!')
        msg.html = ('<h1>Welcome to Our Site</h1>'
                    '<p>This will be super cool!</p>')

        mail.send(msg)

        return redirect(url_for('index'))
    return render_template('register.html', **context)
Exemplo n.º 7
0
def register():
    title = "Meridian Meditations | Register"
    form = UserInfoForm()
    if request.methods == 'POST' and form.validate():
        username = form.username.data
        password = form.password.data
        email = form.email.data
        new_user = User(username, email, password)
        db.session.add(new_user)
        db.session.commit()
        flash("Thank you for signing up. Now you can track your meditation history!", "success")
        return redirect(url_for('welcome'))
    return render_template('register.html', title=title, form=form)

# def login():
#     title = "Meridian Meditations | LOGIN"
#     form = LoginForm()
#     if request.methods == 'POST' and form.validate():
#         username = form.username.data
#         password = form.password.data

#         user = User.query.filter_by(username=username).first()

#         if user is None or not check_password_hash(user.password, password):
#             flash("Incorrect Email/Password. Please try again", 'danger')
#             return redirect(url_for('register'))
        
#         login_user(user, remember=form.remember_me.data)
#         flash("You have successfully logged in!", 'success')
#         next_page = request.args.get('next')
#         if next_page:
#             return redirect(url_for('home'))

#     return render_template('register.html', title=title, form=form)


# @app.route('/logout')
# def logout():
#     logout_user()
#     flash("You have succesfully logged out", 'primary')
#     return redirect(url_for('home'))

# # @app.route('/createMcard')
# # @app.route('/createMcard.html', methods=['GET', 'POST'])
# # def createMcard():
# #     title = "Meridian Meditions | Get My Meditation"
# #     form = CreateMcardForm()
# #     if request.method == 'POST' and form.validate():
# #         climate = form.climate.data
# #         taste = form.taste.data
# #         emotions = form.emotions.data
# #           mcard = Mcard()
# #         db.session.commit()
      
         
# #        return render_template("mcards.html", form=form)

    
Exemplo n.º 8
0
def signup():
    title = "GecMonitor | Sign Up"
    form = UserInfoForm()
    if request.method == 'POST' and form.validate():
        first_name = form.first_name.data
        last_name = form.last_name.data
        email = form.email.data
        password = form.password.data
        new_user = User(first_name, last_name, email, password)
        db.session.add(new_user)
        db.session.commit()
        flash("You have successfully signed up!", "success")
        return redirect(url_for('index'))
    return render_template('signup.html', title=title, form=form)
Exemplo n.º 9
0
def register():
    Form = UserInfoForm()
    if request.method == 'POST' and Form.validate():
        username = Form.username.data
        email = Form.email.data
        address = Form.address.data
        phone = Form.phone.data
        password = Form.password.data
        new_user = User(username, email, password, address, phone)
        db.session.add(new_user)
        db.session.commit()
        flash('You have made an account', 'success')
        return render_template('index.html', title='Lucky | Home')
        print(username,email,password)
    return render_template('register.html', title='Lucky | Register', form=UserInfoForm())
Exemplo n.º 10
0
def register():
    form = UserInfoForm()
    if request.method == 'POST' and form.validate():  # should be ==
        # Get Information
        username = str(form.username.data)
        password = str(form.password.data)
        email = str(form.email.data)
        print("\n", username, password, email)
        # Create an instance of User
        user = User(username, email, password)
        # Open and insert into database
        db.session.add(user)
        # Save info into database
        db.session.commit()

        # Flask Email Sender

    return render_template('register.html', form=form)
Exemplo n.º 11
0
def register():
    form = UserInfoForm()

    context = {'form': form}
    if request.method == 'POST' and form.validate():

        username = form.username.data
        email = form.email.data
        password = form.password.data

        new_user = User(username, email, password)
        db.session.add(new_user)
        db.session.commit()

        flash("You have successfully registered", 'success')

        return redirect(url_for('index'))
    return render_template('register.html', **context)
Exemplo n.º 12
0
def register():
    form = UserInfoForm()
    if request.method == 'POST' and form.validate():
        # Get Information
        id = User.id
        username = form.username.data
        email = form.email.data
        password = form.password.data
        print("\n", username, email, password)
        # Create an instance of User
        user = User(username, email, password)
        # Open and insert into database
        db.session.add(user)
        # Save info into database
        db.session.commit()

        # Flask Email Sender
        return redirect(url_for('login'))
    return render_template('register.html', form=form)
Exemplo n.º 13
0
def register():
    title = "Phonebook | REGISTER"
    form = UserInfoForm()
    if request.method == "POST" and form.validate():
        username= form.username.data
        password= form.password.data
        email = form.email.data
        phone= form.phone.data

        new_user=User(username, email, phone, password)
        db.session.add(new_user)
        db.session.commit()

        welcome = Message(f'Welcome, {username}', [email])
        welcome.html = '<p>Thank you for signing up! Your phone is now in our phonebook</p>'
        mail.send(welcome)
        flash ("You have added your entry", "success")
        return redirect(url_for("index"))
    return render_template('registerphone.html', title= title, form=form)