Skip to content

Commit

Permalink
Login teaser
Browse files Browse the repository at this point in the history
  • Loading branch information
s2t2 committed Apr 9, 2024
1 parent d8d1a73 commit f4773bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
9 changes: 9 additions & 0 deletions app/models/login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

#from app.db import BaseModel
#
#class Login(BaseModel):
#
# SHEET_NAME = "logins"
#
# COLUMNS = ["email", "verified", "first_name", "last_name", "profile_photo_url"]
#
19 changes: 8 additions & 11 deletions web_app/routes/auth_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
from flask import session, flash, redirect, current_app
from flask import Blueprint, session, redirect, url_for, render_template #request, , , jsonify

from app.models.login import Login

auth_routes = Blueprint("auth_routes", __name__)

@auth_routes.route("/login")
def login():
print("LOGIN...")
# this is a login page for either google or email/password auth (but the latter not implemented at the moment):
return render_template("login.html")
# if not using email/password auth, consider shortcut directly to google login:
#return redirect("/auth/google/login")

@auth_routes.route("/auth/google/login")
def google_login():
Expand Down Expand Up @@ -46,18 +45,16 @@ def google_oauth_callback():
#> }
print("USER INFO:", user_info["email"], user_info["name"])

# add user info to the session
# add user info to the session:
session["current_user"] = user_info

# store the user info in the database:
#service = current_app.config["SPREADSHEET_SERVICE"]
#service.update_user({
# consider storing the user login info in the database:
#Login.create({
# "email": user_info["email"],
# "verified": user_info["email_verified"],
# "given_name": user_info["given_name"],
# "family_name": user_info["family_name"],
# "picture": user_info["picture"],
# "locale": user_info["locale"],
# "first_name": user_info["given_name"],
# "last_name": user_info["family_name"],
# "profile_photo_url": user_info["picture"],
#})

else:
Expand Down
2 changes: 1 addition & 1 deletion web_app/routes/home_routes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from flask import Blueprint, render_template, current_app #, session
from flask import Blueprint, render_template #, current_app #, session

home_routes = Blueprint("home_routes", __name__)

Expand Down

0 comments on commit f4773bf

Please sign in to comment.