|
@ -36,7 +36,8 @@ from registerform import RegisterForm |
|
|
from uploadform import UploadForm |
|
|
from uploadform import UploadForm |
|
|
|
|
|
|
|
|
# Tada! |
|
|
# Tada! |
|
|
import distribusi |
|
|
from distribusi.cli import build_argparser |
|
|
|
|
|
from distribusi.distribusi import distribusify |
|
|
|
|
|
|
|
|
APP = create_app() |
|
|
APP = create_app() |
|
|
|
|
|
|
|
@ -58,7 +59,7 @@ def login(): |
|
|
if loginform.validate_on_submit(): |
|
|
if loginform.validate_on_submit(): |
|
|
try: |
|
|
try: |
|
|
user = User.query.filter_by(email=loginform.email.data).first() |
|
|
user = User.query.filter_by(email=loginform.email.data).first() |
|
|
if check_password_hash(user.pwd, loginform.password.data): |
|
|
if check_password_hash(user.password, loginform.password.data): |
|
|
login_user(user) |
|
|
login_user(user) |
|
|
flash("Logged in successfully.", "success") |
|
|
flash("Logged in successfully.", "success") |
|
|
next = request.args.get("next") |
|
|
next = request.args.get("next") |
|
@ -78,17 +79,17 @@ def register(): |
|
|
if registerform.validate_on_submit(): |
|
|
if registerform.validate_on_submit(): |
|
|
try: |
|
|
try: |
|
|
email = registerform.email.data |
|
|
email = registerform.email.data |
|
|
pwd = registerform.confirmpassword.data |
|
|
password = registerform.confirmpassword.data |
|
|
|
|
|
|
|
|
newuser = User( |
|
|
newuser = User( |
|
|
email=email, |
|
|
email=email, |
|
|
pwd=generate_password_hash(pwd), |
|
|
password=generate_password_hash(password), |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
db.session.add(newuser) |
|
|
db.session.add(newuser) |
|
|
db.session.commit() |
|
|
db.session.commit() |
|
|
flash("Account Succesfully created", "success") |
|
|
flash("Account Succesfully created", "success") |
|
|
return redirect(url_for("login")) |
|
|
return redirect(url_for("index")) |
|
|
|
|
|
|
|
|
except InvalidRequestError: |
|
|
except InvalidRequestError: |
|
|
db.session.rollback() |
|
|
db.session.rollback() |
|
|