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