diff --git a/app/routes/auth_routes.py b/app/routes/auth_routes.py index 4e5a67b..05c1f5b 100644 --- a/app/routes/auth_routes.py +++ b/app/routes/auth_routes.py @@ -27,13 +27,18 @@ def login(): return redirect(url_for('user_routes.user_profile', user_id=current_user.id)) if request.method == 'POST': - email = request.form["email"] + email = request.form.get("email").strip().lower() password = request.form["password"] next_page = request.form.get("next") + remember_me = request.form.get('remember_me') + + # Convert checkbox to boolean + remember = True if remember_me == "on" else False + user = User.query.filter_by(email=email).first() if user and check_password_hash(user.password_hash, password): - login_user(user) + login_user(user, remember=remember) if next_page and is_safe_url(next_page): return redirect(next_page) diff --git a/app/routes/user_routes.py b/app/routes/user_routes.py index bb7e16f..2179d0d 100644 --- a/app/routes/user_routes.py +++ b/app/routes/user_routes.py @@ -32,10 +32,11 @@ def register(): first_name = data.get('first_name') last_name = data.get('last_name') username = data.get('username') - email = data.get('email') + email = data.get('email').strip().lower() password = data.get('password') + confirm_password = request.form.get('confirm_password') - if not first_name or not last_name or not username or not email or not password: + if not first_name or not last_name or not username or not email or not password or not confirm_password: flash('All fields are required', 'error') return redirect(url_for('user_routes.register')) @@ -56,9 +57,13 @@ def register(): return redirect(url_for('user_routes.register')) try: - create_user(first_name, last_name, username, email, password) - flash('Registration successful, proceed to login!', 'info') - return redirect(url_for('auth.login')) + if password == confirm_password: + create_user(first_name, last_name, username, email, password) + flash('Registration successful, proceed to login!', 'info') + return redirect(url_for('auth.login')) + else: + flash('Password and confirm password do not match', 'error') + except Exception as e: db.session.rollback() flash('An error occured during registeration. Please try again', 'error') diff --git a/app/static/css/recipe_form.css b/app/static/css/recipe_form.css index 12cc714..2b5e80b 100644 --- a/app/static/css/recipe_form.css +++ b/app/static/css/recipe_form.css @@ -1,15 +1,54 @@ -.navbar-brand { - font-family: 'Raleway', sans-serif; - font-weight: 800; -} - - .input-group { display: flex; align-items: center; gap: 8px; } +/* Hide the default checkbox */ +.ingredient-checkbox:checked+label .custom-checkbox { + background-color: gray; + border-color: gray; +} + +.ingredient-checkbox:checked+label .custom-checkbox:before { + content: '\2713'; + /* Unicode checkmark */ + display: block; + color: white; + font-size: 0.75rem; + text-align: center; + line-height: 1rem; +} + +/* Custom checkbox styling */ +.custom-checkbox { + position: relative; + display: inline-block; + width: 1rem; + height: 1rem; + background-color: white; + border: 2px solid gray; + border-radius: 0.25rem; + box-sizing: border-box; +} + +.custom-checkbox:before { + content: ''; + position: absolute; + width: 100%; + height: 100%; + display: none; +} + +.ingredient-checkbox:checked+label .custom-checkbox:before { + display: block; +} + +/* Styling for crossed-out ingredient labels */ +.line-through { + text-decoration: line-through; +} + .input-group input { flex: 1; } diff --git a/app/static/images/cooking.png b/app/static/images/cooking.png new file mode 100644 index 0000000..3dbcc97 Binary files /dev/null and b/app/static/images/cooking.png differ diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index f70c6bf..56c6b78 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -9,4 +9,11 @@ document.addEventListener('DOMContentLoaded', function () flash.style.display = 'none'; }, 5000); // Flash message disappears after 5 seconds }); + + // Toggle mobile menu + document.getElementById('mobile-menu-button').addEventListener('click', function () + { + var menu = document.getElementById('mobile-menu'); + menu.classList.toggle('hidden'); + }); }); diff --git a/app/templates/index.html b/app/templates/index.html index 01fefcb..8703007 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -4,9 +4,11 @@ - + + + SpiceShare - Share Your Taste, Explore New Flavors - +