Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed verification messages bug #148

Merged
merged 5 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dist: focal
language: python
python:
- "3.10"
- "3.11"

# Only run this repo's builds.
before_install:
Expand Down Expand Up @@ -32,15 +32,23 @@ script:
# after_script:
# - coveralls

before_deploy:
# Only deploy if this is a merge build, not a PR.
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "Pull request build, skipping deploy."; exit 0; fi
# Package the deployable artifact.
- zip -r deploy_package.zip . -x "*.git*" -x "**/__pycache__/*" -x "*.pyc" -x "venv/*"
stages:
- name: test
- name: deploy_develop
if: branch = develop AND type = push
- name: deploy_main
if: branch = main AND type = push


jobs:
include:
- stage: "Deploy to Develop Environment"
- stage: test
script:
- black --check .

- stage: deploy_develop
before_deploy:
- zip -r deploy_package.zip . -x "*.git*" -x "**/__pycache__/*" -x "*.pyc" -x "venv/*"
deploy:
provider: elasticbeanstalk
access_key_id: "$AWS_ACCESS_KEY_ID_INT"
Expand All @@ -55,7 +63,9 @@ jobs:
on:
branch: develop

- stage: "Deploy to Production Environment"
- stage: deploy_main
before_deploy:
- zip -r deploy_package.zip . -x "*.git*" -x "**/__pycache__/*" -x "*.pyc" -x "venv/*"
deploy:
provider: elasticbeanstalk
access_key_id: "$AWS_ACCESS_KEY_ID_MAIN"
Expand Down
10 changes: 5 additions & 5 deletions accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.messages import get_messages
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm

Expand Down Expand Up @@ -36,18 +38,16 @@ def user_logout(request):
return redirect("login") # Redirect to login page after logout


from django.shortcuts import render, redirect
from django.contrib import messages


def verify(request):
if request.method == "GET":
list(get_messages(request))

# If the user is already verified, show success message
if request.user.profile.is_verified:
return render(request, "accounts/verify.html", {"success": True})

if request.method == "POST":
answer = request.POST.get("answer")
# Check the answer (in this example, the correct answer is "42")
if answer == "ParkEasy":
request.user.profile.is_verified = True
request.user.profile.save()
Expand Down