Skip to content

Commit

Permalink
Signup HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
SameeranB committed Oct 16, 2019
1 parent e8f010e commit d98f545
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Main/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib.auth import authenticate, login
from django.shortcuts import render
from django.http import HttpResponse

Expand All @@ -15,9 +16,9 @@ def signUp_view(request):
def login_view(request):
username = request.data.get('username')
password = request.data.get('password')
user = authenticate(username, password)
if user.is_valid():
user.login()
user = authenticate(request, username=username, password=password)
if user is not None:
login(request, user)
return HttpResponse(201)
else:
return HttpResponse(405)
22 changes: 22 additions & 0 deletions templates/Main/Signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
{% load static %}
{% load staticfiles %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Signup</title>
</head>
<body>

<form method="post" action="{% url 'signUp' %}">
{% csrf_token %}
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<input type="text" placeholder="First Name">
<input type="text" placeholder="Last Name">
<input type="email" placeholder="Email Address">
<input type="submit" value="Submit">
</form>

</body>
</html>

0 comments on commit d98f545

Please sign in to comment.