Skip to content

Commit

Permalink
More views where login is not required.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmenezes0 committed Aug 12, 2024
1 parent af6f138 commit 1a40407
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions consultation_analyser/consultations/views/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from django.http import HttpRequest
from django.shortcuts import redirect, render
from magic_link.models import MagicLink
from django.contrib.auth.decorators import login_not_required

from consultation_analyser.authentication.models import User
from consultation_analyser.consultations.forms.sessions import NewSessionForm
from consultation_analyser.email import send_magic_link_email
from consultation_analyser.hosting_environment import HostingEnvironment


@login_not_required
def send_magic_link_if_email_exists(request: HttpRequest, email: str) -> None:
try:
user = User.objects.get(email=email)
Expand All @@ -26,6 +28,7 @@ def send_magic_link_if_email_exists(request: HttpRequest, email: str) -> None:
pass


@login_not_required
def new(request: HttpRequest):
if request.user.is_authenticated:
return redirect("/")
Expand All @@ -42,6 +45,7 @@ def new(request: HttpRequest):
return render(request, "consultations/sessions/new.html", {"form": form})


@login_not_required
def destroy(request: HttpRequest):
logout(request)
messages.success(request, "You have signed out")
Expand Down

0 comments on commit 1a40407

Please sign in to comment.