Skip to the content.
Home TPT Notes and Actions Data Structures Plan Create Task Quiz Corrections Proctored MCQ Weeks Part 1 Study Plan Others

Week 4

Phone Number

@app_crud.route('/authorize/', methods=["GET", "POST"])
def crud_authorize():
    # check form inputs and creates user
    if request.form:
        # validation should be in HTML
        user_name = request.form.get("user_name")
        email = request.form.get("email")
        password1 = request.form.get("password1")
        phone = request.form.get("phone")
        password2 = request.form.get("password1")           # password should be verified
        if authorize(user_name, email, password1, phone):    # zero index [0] used as user_name and email are type tuple
            return redirect(url_for('crud.crud_login'))
    # show the auth user page if the above fails for some reason
    return render_template("authorize.html")
  <td></td>

Logout and login_required for other part

@app_crud.route('/crud_logout')
  @login_required
  def crud_logout():
    logout_user() # removes login state of user from session
    return render_template("login.html")
  <div class="container py-4">
      <span class="fs-4; align-content-end"><a href=>Logout </a></span>
  </div>

Hack 3 Done

from flask import Blueprint, render_template
from flask_login import login_required

app_frontend = Blueprint('frontend', __name__,
                         url_prefix='/frontend',
                         template_folder='templates/frontend/',
                         static_folder='static',
                         static_url_path='static/assets')


@app_frontend.route('/graph')
def graph():
    return render_template("graph.html")


@app_frontend.route('/life')
def life():
    return render_template("life.html")


@app_frontend.route('/snake')
@login_required
def snake():
    return render_template("snake.html")