generated from nyu-software-engineering/web-app-exercise
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from software-students-spring2024/authenticati…
…on-contd Signup and login redirection is done
- Loading branch information
Showing
6 changed files
with
61 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ name = "pypi" | |
pymongo = "*" | ||
flask = "*" | ||
python-dotenv = "*" | ||
flask-login = "*" | ||
|
||
[dev-packages] | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
from flask import render_template | ||
from flask import render_template, request, redirect, url_for, session | ||
from flask_login import LoginManager | ||
import app | ||
|
||
def login(): | ||
return render_template('login.html') | ||
|
||
def signup(): | ||
return render_template('signup.html') | ||
login_manager = LoginManager() | ||
|
||
class User(): | ||
def __init__(self, is_authenticated, is_active, is_anonymous): | ||
self.is_authenticated = is_authenticated | ||
self.is_active = is_active | ||
self.is_anonymous = is_anonymous | ||
|
||
|
||
def login(db): | ||
print(db) | ||
if request.method == 'POST': | ||
## TODO: Login | ||
return "Someone pressed the login button huh, I better log you in." | ||
else: | ||
return render_template('login.html') | ||
|
||
def signup(db): | ||
if request.method == 'POST': | ||
username = request.form["username"] | ||
password = request.form["password"] | ||
else: | ||
return render_template('signup.html') | ||
|
||
# TODO: Handle autehentication and session management with flask-login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters