Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def user_login(request):
- if request.method == 'POST':
- username = request.POST.get('username')
- password = request.POST.get('password')
- user = authenticate(username=username, password=password)
- if user:
- if user.is_active:
- login(request, user)
- return HttpResponseRedirect('/friends_plans/users/', {'username': username, })
- else:
- return HttpResponse("Your account is disabled")
- else:
- print "Invalid login details: {0}, {1}".format(username, password)
- return HttpResponse("Invalid login details supplied.")
- else:
- return render(request, 'friends_plans/index.html', {})
- {% load staticfiles %}
- <html >
- <head >
- <title> Friends' Plans </title>
- <meta charset ="utf -8" />
- <link rel="stylesheet" href="{% static 'css/friends_plans.css' %}">
- </head >
- <body >
- <div id ="container">
- <div id ="header">
- <ul id ="menu">
- <span><a id="firstbutton" href ="" >Friends' Plans</a> </span>
- <span><a id="helpbutton" href ="" >HELP</a></span>
- </ul>
- </div>
- <div id ="left">
- <form id="login_form" method="post" action="">
- {% csrf_token %}
- Username: <input type ="text" name ="username" value="" size="50" /> <br />
- Password: <input type ="password" name ="password" value="" size="50"/> <br />
- <input type ="submit" value="submit" />
- </form>
- {% if user.is_authenticated %}
- <a href="/friends_plans/logout/">Logout</a>
- {% else %}
- <a href="/friends_plans/register/">Register here</a><br />
- {% endif %}
- </div>
- <div id ="right">
- <h1 id="welcome">Welcome to Friends' Plans</h1>
- <img class="cat" src={% static 'images/cat4.jpg' %} />
- <img class="cat" src={% static 'images/cat2.jpg' %} />
- <img class="cat" src={% static 'images/cat3.jpg' %} />
- <img class="cat" src={% static 'images/cat6.jpg' %} />
- <img class="cat" src={% static 'images/cat5.jpg' %} />
- <img class="cat" src={% static 'images/cat1.jpg' %} />
- </div>
- <div id ="footer"> Copyright </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment