Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
312a6731
authored
11 years ago
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: password reset
parent
53269ec8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
4 deletions
+161
-4
circle/circle/urls.py
+13
-1
circle/dashboard/forms.py
+48
-1
circle/templates/registration/base.html
+9
-1
circle/templates/registration/login.html
+3
-1
circle/templates/registration/password_reset_complete.html
+20
-0
circle/templates/registration/password_reset_confirm.html
+28
-0
circle/templates/registration/password_reset_done.html
+18
-0
circle/templates/registration/password_reset_form.html
+22
-0
No files found.
circle/circle/urls.py
View file @
312a6731
...
...
@@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse
from
circle.settings.base
import
get_env_variable
from
dashboard.views
import
circle_login
from
dashboard.forms
import
CirclePasswordResetForm
,
CircleSetPasswordForm
admin
.
autodiscover
()
...
...
@@ -25,6 +25,18 @@ urlpatterns = patterns(
url
(
r'^admin/'
,
include
(
admin
.
site
.
urls
)),
url
(
r'^network/'
,
include
(
'network.urls'
)),
url
(
r'^dashboard/'
,
include
(
'dashboard.urls'
)),
url
((
r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]{1,13})-'
'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
),
'django.contrib.auth.views.password_reset_confirm'
,
{
'set_password_form'
:
CircleSetPasswordForm
},
name
=
'accounts.password_reset_confirm'
),
url
(
r'^accounts/password/reset/$'
,
(
"django.contrib.auth.views."
"password_reset"
),
{
'password_reset_form'
:
CirclePasswordResetForm
},
name
=
"accounts.password-reset"
,
),
url
(
r'^accounts/login/?$'
,
circle_login
,
name
=
"accounts.login"
),
url
(
r'^accounts/'
,
include
(
'django.contrib.auth.urls'
)),
)
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/forms.py
View file @
312a6731
...
...
@@ -2,7 +2,9 @@ from datetime import timedelta
import
uuid
from
django.contrib.auth.models
import
User
from
django.contrib.auth.forms
import
AuthenticationForm
from
django.contrib.auth.forms
import
(
AuthenticationForm
,
PasswordResetForm
,
SetPasswordForm
,
)
from
crispy_forms.helper
import
FormHelper
from
crispy_forms.layout
import
(
...
...
@@ -805,6 +807,51 @@ class CircleAuthenticationForm(AuthenticationForm):
return
helper
class
CirclePasswordResetForm
(
PasswordResetForm
):
# fields: email
@property
def
helper
(
self
):
helper
=
FormHelper
()
helper
.
form_show_labels
=
False
helper
.
layout
=
Layout
(
AnyTag
(
"div"
,
AnyTag
(
"span"
,
AnyTag
(
"i"
,
css_class
=
"icon-envelope"
,
),
css_class
=
"input-group-addon"
,
),
Field
(
"email"
,
placeholder
=
_
(
"Email address"
),
css_class
=
"form-control"
),
Div
(
AnyTag
(
"button"
,
HTML
(
_
(
"Reset password"
)),
css_class
=
"btn btn-success"
,
),
css_class
=
"input-group-btn"
,
),
css_class
=
"input-group"
,
),
)
return
helper
class
CircleSetPasswordForm
(
SetPasswordForm
):
@property
def
helper
(
self
):
helper
=
FormHelper
()
helper
.
add_input
(
Submit
(
"submit"
,
_
(
"Change password"
),
css_class
=
"btn btn-success change-password"
,
css_id
=
"submit-password-button"
))
return
helper
class
LinkButton
(
BaseInput
):
"""
...
...
This diff is collapsed.
Click to expand it.
circle/templates/registration/base.html
View file @
312a6731
...
...
@@ -4,7 +4,7 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Bootstrap, from Twitter
</title>
<title>
{% block title %}{% endblock %} | CIRCLE
</title>
<meta
name=
"description"
content=
""
>
<meta
name=
"author"
content=
""
>
...
...
@@ -60,6 +60,14 @@
width
:
38px
;
}
.form-group
label
{
margin-top
:
20px
;
}
#submit-password-button
{
margin-top
:
15px
;
}
/* fix for crispy-forms' html */
.form-group
{
margin-bottom
:
0px
;
...
...
This diff is collapsed.
Click to expand it.
circle/templates/registration/login.html
View file @
312a6731
...
...
@@ -3,6 +3,8 @@
{% load crispy_forms_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
<div
class=
"row"
>
{% if form.password.errors or form.username.errors %}
...
...
@@ -29,7 +31,7 @@
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<a
class=
"pull-right"
href=
""
>
Forgot your password?
</a>
<a
class=
"pull-right"
href=
"
{% url "
accounts
.
password-reset
"
%}
"
>
Forgot your password?
</a>
</div>
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
circle/templates/registration/password_reset_complete.html
0 → 100644
View file @
312a6731
{% extends "registration/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}{% trans "Password reset complete" %}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"login-form-errors"
>
{% include "display-form-errors.html" %}
</div>
<div
class=
"col-sm-12"
>
<div
class=
"alert alert-success"
>
{% trans "Password change succesful!" %}
<a
href=
"{% url "
accounts
.
login
"
%}"
>
{% trans "Click here to login" %}
</a>
</div>
</div>
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
circle/templates/registration/password_reset_confirm.html
0 → 100644
View file @
312a6731
{% extends "registration/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}{% trans "Password reset confirm" %}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"login-form-errors"
>
{% include "display-form-errors.html" %}
</div>
<div
class=
"col-sm-12"
>
<div
style=
"margin: 0 0 25px 0;"
>
{% blocktrans %}Please enter your new password twice so we can verify you typed it in correctly!{% endblocktrans %}
</div>
{% if form %}
{% crispy form %}
{% else %}
<div
class=
"alert alert-warning"
>
{% trans "This token is expired, please request a new password reset link again!" %}
<a
href=
"{% url "
accounts
.
password-reset
"
%}"
>
a
</a>
</div>
{% endif %}
</div>
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
circle/templates/registration/password_reset_done.html
0 → 100644
View file @
312a6731
{% extends "registration/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}{% trans "Password reset done" %}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"login-form-errors"
>
{% include "display-form-errors.html" %}
</div>
<div
class=
"col-sm-12"
>
<div
class=
"pull-right"
><a
href=
"{% url "
accounts
.
login
"
%}"
>
Back to login
</a></div>
{% trans "We have sent you an email about your next steps!" %}
</div>
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
circle/templates/registration/password_reset_form.html
0 → 100644
View file @
312a6731
{% extends "registration/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}{% trans "Password reset" %}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"login-form-errors"
>
{% include "display-form-errors.html" %}
</div>
<div
class=
"col-sm-12"
>
<div
class=
"pull-right"
><a
href=
"{% url "
accounts
.
login
"
%}"
>
Back to login
</a></div>
<h4
style=
"margin: 0 0 25px 0;"
>
{% blocktrans %}Enter your email address to reset your password!{% endblocktrans %}
</h4>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
{% crispy form %}
</form>
</div>
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment