Skip to content

Commit

Permalink
creating signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfs committed Feb 13, 2014
1 parent b42fe64 commit bc2fec4
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ nosetests.xml

.DS_Store

*.sublime-project
*.sublime-workspace

reminder.md

*.sqlite3
Expand Down
14 changes: 14 additions & 0 deletions core/static/css/signup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
div.signup form input {
font-size: 0.8em;
margin-bottom: 1.2em;
}

div.signup form label {
font-weight: 600;
font-size: 1.0em;
}

div.signup h1.join {
margin-bottom: 0.8em;
font-size: 1.8em;
}
28 changes: 28 additions & 0 deletions core/templates/core/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends 'base.html' %}

{% block title %}Parsifal - Sign up{% endblock title %}

{% block head_extra %}
<link href="{{ STATIC_URL }}css/signup.css" rel="stylesheet" media="screen">
{% endblock head_extra %}

{% block content %}
<div class="signup">
<h1 class="join">Sign up for Parsifal</h1>
<form action="/users/new/" method="post">
{% csrf_token %}
<label for="username">Username:</label>
<input type="text" placeholder="" name="username">

<label for="email">Email Address:</label>
<input type="text" placeholder="" name="email">

<label for="email">Password:</label>
<input type="password" placeholder="" name="password">

<label for="confirm-password">Confirm your password:</label>
<input type="password" placeholder="" name="confirm-password">
<button type="submit" class="btn btn-success">Create an account</button>
</form>
</div>
{% endblock content %}
4 changes: 4 additions & 0 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def home(request):
else:
return render_to_response('core/cover.html', context)

def signup(request):
context = RequestContext(request)
return render_to_response('core/signup.html', context)

def signin(request):
if request.user.is_authenticated():
return redirect('/')
Expand Down
1 change: 1 addition & 0 deletions parsifal/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

urlpatterns = patterns('',
(r'^$', 'core.views.home'),
(r'^signup/$', 'core.views.signup'),
(r'^signin/$', 'core.views.signin'),
(r'^signout/$', 'core.views.signout'),
(r'^news/$', 'core.views.news'),
Expand Down
26 changes: 13 additions & 13 deletions templates/base_app.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
<body>
<div class="wrapper">
<div class="texture clearfix">
<header>
<h1><a href="/">Parsifal</a></h1>
<nav class="menu">
<a href="/news/">News</a>
<a href="/about/">About</a>
<a href="/help/">Help</a>
</nav>
<nav class="signedin">
<a href="/{{ user.username }}/" class="user">{{ user.username }}</a>
<a href="/settings/">Account Settings</a>
<a href="/signout/">Sign Out</a>
</nav>
</header>
<header>
<h1><a href="/">Parsifal</a></h1>
<nav class="menu">
<a href="/news/">News</a>
<a href="/about/">About</a>
<a href="/help/">Help</a>
</nav>
<nav class="signedin">
<a href="/{{ user.username }}/" class="user">{{ user.username }}</a>
<a href="/settings/">Account Settings</a>
<a href="/signout/">Sign Out</a>
</nav>
</header>
</div>
<section class="content">
{% if messages %}
Expand Down
4 changes: 2 additions & 2 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def new(request):
email = request.POST['email']

if username == '' or password == '' or email == '':
return redirect('/')
return redirect('/signup/')

unique_username = User.objects.filter(username=username)
unique_email = User.objects.filter(email=email)

if unique_username or unique_email:
return redirect('/')
return redirect('/signup/')

User.objects.create_user(username=username, password=password, email=email)
user = authenticate(username=username, password=password)
Expand Down

0 comments on commit bc2fec4

Please sign in to comment.