Kevin Veroneau avatar Kevin Veroneau committed 8ae2ea8

Added django-registration templates and forms needed for easy Captcha support.

Comments (0)

Files changed (16)

bootstrap_theme/forms.py

+from registration.forms import RegistrationForm
+from captcha.fields import ReCaptchaField
+
+class RegistrationFormCaptcha(RegistrationForm):
+    captcha = ReCaptchaField(attrs={'theme': 'white'})

bootstrap_theme/registration_urls.py

+from registration.views import activate, register
+from django.conf import settings
+from django.conf.urls import patterns, url, include
+from django.views.generic.base import TemplateView
+
+if 'RECAPTCHA_PUBLIC_KEY' in dir(settings):
+    from bootstrap_theme.forms import RegistrationFormCaptcha as RegistrationForm
+else:
+    from registration.forms import RegistrationForm
+
+urlpatterns = patterns('',
+    url(r'^activate/complete/$', TemplateView.as_view(template_name='registration/activation_complete.html'), name='registration_activation_complete'),
+    url(r'^activate/(?P<activation_key>\w+)/$', activate, {'backend': 'registration.backends.default.DefaultBackend'}, name='registration_activate'),
+    url(r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend', 'form_class':RegistrationForm}, name='registration_register'),
+    url(r'^register/complete/$', TemplateView.as_view(template_name='registration/registration_complete.html'), name='registration_complete'),
+    url(r'^register/closed/$', TemplateView.as_view(template_name='registration/registration_closed.html'), name='registration_disallowed'),
+    (r'', include('registration.auth_urls')),
+)

bootstrap_theme/templates/registration/activate.html

+{% extends "base.html" %}
+
+{% block title %}Action problem{% endblock %}
+
+{% block content %}
+<h2>There was a problem with the activation of this account.  Perhaps it is already activated.</h2>
+{% endblock %}

bootstrap_theme/templates/registration/activation_complete.html

+{% extends "base.html" %}
+
+{% block title %}Activation complete{% endblock %}
+
+{% block content %}
+<h2>Your account is now active! You may now <a href="{% url 'auth_login' %}">sign-in</a>.</h2>
+{% endblock %}

bootstrap_theme/templates/registration/activation_email.txt

+Hello,
+
+  Welcome to Django site!  Click on the activation link below:
+  
+  http://{{site.domain}}{% url 'registration_activate' activation_key %}
+
+Best Regards,

bootstrap_theme/templates/registration/activation_email_subject.txt

+Welcome to Django site

bootstrap_theme/templates/registration/login.html

+{% extends "base.html" %}
+
+{% block title %}Sign In | {% endblock %}
+
+{% block css %}
+{{block.super}}
+      body {
+        padding-top: 40px;
+        padding-bottom: 40px;
+        background-color: #f5f5f5;
+      }
+
+      .form-signin {
+        max-width: 300px;
+        padding: 19px 29px 29px;
+        margin: 0 auto 20px;
+        background-color: #fff;
+        border: 1px solid #e5e5e5;
+        -webkit-border-radius: 5px;
+           -moz-border-radius: 5px;
+                border-radius: 5px;
+        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
+           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
+                box-shadow: 0 1px 2px rgba(0,0,0,.05);
+      }
+      .form-signin .form-signin-heading,
+      .form-signin .checkbox {
+        margin-bottom: 10px;
+      }
+      .form-signin input[type="text"],
+      .form-signin input[type="password"] {
+        font-size: 16px;
+        height: auto;
+        margin-bottom: 15px;
+        padding: 7px 9px;
+      }
+{% endblock %}
+
+{% block content %}
+      <form class="form-signin" action="{% url 'auth_login' %}" method="post">{% csrf_token %}
+        <h2 class="form-signin-heading">Please sign in</h2>
+        <input type="text" name="username" class="input-block-level" placeholder="Username">
+        <input type="password" name="password" class="input-block-level" placeholder="Password">
+        {% comment %}
+        <label class="checkbox">
+          <input type="checkbox" value="remember-me"> Remember me
+        {% endcomment %}
+        </label><input type="hidden" name="next" value="{{ next }}" />
+        <button class="btn btn-large btn-primary" type="submit">Sign in</button>
+      </form>
+{% endblock %}

bootstrap_theme/templates/registration/logout.html

+{% extends "base.html" %}
+
+{% block title %}Signed out{% endblock %}
+
+{% block content %}
+<h2>You have been successfully logged out.</h2>
+{% endblock %}

bootstrap_theme/templates/registration/password_change_form.html

+{% extends "base.html" %}
+
+{% block title %}Change Password{% endblock %}
+
+{% block content %}
+          <form action="{% url 'auth_password_change' %}" method="post">{% csrf_token %}
+            <fieldset>
+              <legend>Change your password</legend>
+              {% include "bootstrap_form.html" %}
+              <button type="submit" class="btn btn-primary">Change password</button>
+            </fieldset>
+          </form>
+{% endblock %}

bootstrap_theme/templates/registration/password_reset_complete.html

+{% extends "base.html" %}
+
+{% block title %}Password reset complete{% endblock %}
+
+{% block content %}
+<h2>Password reset complete</h2>
+<p>Your password has been set.  You may go ahead and <a href="{% url 'auth_login' %}">log in</a> now.</p>
+{% endblock %}

bootstrap_theme/templates/registration/password_reset_confirm.html

+{% extends "base.html" %}
+
+{% block title %}Password reset confirmation{% endblock %}
+
+{% block content %}
+{% if validlink %}
+          <form action="" method="post">{% csrf_token %}
+            <fieldset>
+              <legend>Choose new password</legend>
+              {% include "bootstrap_form.html" %}
+              <button type="submit" class="btn btn-primary">Change password</button>
+            </fieldset>
+          </form>{% else %}
+<h2>Password reset unsuccessful</h2>
+<p>The password reset link was invalid, possibly because it has already been used.  Please request a new password reset.</p>
+{% endif %}
+{% endblock %}

bootstrap_theme/templates/registration/password_reset_done.html

+{% extends "base.html" %}
+
+{% block title %}Password reset successful{% endblock %}
+
+{% block content %}
+<h2>Password reset successful</h2>
+<p>We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly.</p>
+{% endblock %}

bootstrap_theme/templates/registration/password_reset_form.html

+{% extends "base.html" %}
+
+{% block content %}
+      <div class="row-fluid">
+        <div class="span6">
+          <form class="form-horizontal" action="" method="post">{% csrf_token %}
+            <fieldset>
+              <legend>Reset your password</legend>
+              {% include "bootstrap_form.html" %}
+              <button type="submit" class="btn btn-primary">Reset my password</button>
+            </fieldset>
+          </form>
+        </div>
+      </div>
+{% endblock %}

bootstrap_theme/templates/registration/registration_complete.html

+{% extends "base.html" %}
+
+{% block title %}Registration complete{% endblock %}
+
+{% block content %}
+<h2>Check your email for an activation link.</h2>
+{% endblock %}

bootstrap_theme/templates/registration/registration_form.html

+{% extends "base.html" %}
+
+{% block title %}Registration{% endblock %}
+
+{% block content %}
+      <div class="row-fluid">
+        <div class="span6">
+          <form class="form-horizontal" action="{% url 'registration_register' %}" method="post">{% csrf_token %}
+            <fieldset>
+              <legend>Registration form</legend>
+              {% include "bootstrap_form.html" %}
+              <button type="submit" class="btn btn-primary">Sign up</button>
+            </fieldset>
+          </form>
+        </div>
+      </div>
+{% endblock %}

bootstrap_theme/templatetags/bootstrap.py

     return {'static_url':settings.STATIC_URL}
 
 @register.simple_tag
-def icon(i):
-    return '<i class="icon-%s"></i>' % i
-
-@register.simple_tag
 def buttonlink(url, icn):
     return '<a class="btn" href="%s"><i class="icon-%s"></i></a>' % (url, icn)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.