Skip to content
Open
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
9 changes: 6 additions & 3 deletions chat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@


def index(request):
return render(request, "index.html", {})
context = {}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required :)

return render(request, "index.html", context)


def signup(request):
Expand All @@ -31,16 +32,18 @@ def signup(request):
"signup.html",
{"error": "Looks like username, email, and password already exists."},
)
return render(request, "signup.html", {"error": ""})
context = {"error": ""}
return render(request, "signup.html", context)


def logIn(request):
if request.POST:
username = request.POST.get("username")
password = request.POST.get("password")
user = authenticate(username=username, password=password)
invalid = {"error": "Invalid Username/Password"}
if user == None:
return render(request, "login.html", {"error": "Invalid Username/Password"})
return render(request, "login.html", invalid)
else:
login(request, user)
return HttpResponseRedirect("/chat/")
Expand Down