Commit 3fe219fc authored by Bruno Renié's avatar Bruno Renié
Browse files

Merge branch 'master' of github.com:brutasse/django-password-reset

parents eaa07078 04f2b3d7
......@@ -34,6 +34,10 @@ Attributes
``password_reset.forms.PasswordRecoveryForm``. To customize form error
messages, subclass the form and override the ``error_messages`` attribute.
* ``success_url_name``: the name of the URL to redirect to after sending the
recovery email. Change it if you don't use the provided URLconf. Defaults to
``password_reset_sent``.
* ``template_name``: defaults to ``password_reset/recovery_form.html``.
* ``email_template_name``: the template to use for sending the reset link by
......@@ -53,6 +57,11 @@ Methods
* ``send_notification()``: this builds the email context, loads the template
and sends the password reset email.
* ``get_site()``: method to obtain the website's host name. This method first
checks and sets the site from the optional `Django sites framework
<https://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_. If missing, it
will deduce the domain and name by looking at the request object's domain.
RecoverDone
-----------
......
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Givi Khojanashvili <gigovich@gmail.com>, 2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-18 14:11+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Givi Khojanashvili <gigovich@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: forms.py:26
msgid "Username"
msgstr "სახელი"
#: forms.py:27
msgid "Email"
msgstr "Email"
#: forms.py:28
msgid "Username or Email"
msgstr "სახელი ან Email-ი"
#: forms.py:51 forms.py:61 forms.py:73
msgid "Sorry, this user doesn't exist."
msgstr "ბოდიში, ასეთი მომხმარებელი არ არსებობს."
#: forms.py:75
msgid "Unable to find user."
msgstr "შეუძლებელია მომხმარებელის მოძებნა"
#: forms.py:81
msgid "New password"
msgstr "ახალი პაროლი"
#: forms.py:85
msgid "New password (confirm)"
msgstr "ახალი პაროლი (დამოწმება)"
#: forms.py:97
msgid "The two passwords didn't match."
msgstr "ორი პაროლი არ ემთხვევა ერთმანეთს."
#: templates/password_reset/recovery_done.html:3
msgid "New password set"
msgstr "ახალი პაროლი დაყენებულია"
#: templates/password_reset/recovery_done.html:6
msgid ""
"Your password has successfully been reset. You can use it right now on the "
"login page."
msgstr ""
"თქვენი პაროლი იყო წარმატებულად შეცვლილი. თქვენ შეგიძლიათ ის ეხლავე მოიხმაროთ ავტორიზირების გვერდზე"
#: templates/password_reset/recovery_email.txt:1
#, python-format
msgid "Dear %(username)s,"
msgstr "%(username)s,"
#: templates/password_reset/recovery_email.txt:3
#, python-format
msgid ""
"You -- or someone pretending to be you -- has requested a password reset on "
"%(domain)s."
msgstr ""
"თქვენ -- ან ვინმემ თქვენი სახელით -- მოითხოვეთ პაროლის შეცვლა "
"%(domain)s-ზე."
#: templates/password_reset/recovery_email.txt:5
msgid "You can set your new password by following this link:"
msgstr "გადადით შემდეგ ლინკზე და შეძლებთ ახალი პაროლის დაყენებას:"
#: templates/password_reset/recovery_email.txt:9
msgid ""
"If you don't want to reset your password, simply ignore this email and it "
"will stay unchanged."
msgstr ""
"თუ თქვენ არ გსურთ პაროლის შეცვლა ნუ მიაქცევთ ყურადღებას ამ email-ს და "
"თქვენი პაროლი უცვლელი დარჩება"
#: templates/password_reset/recovery_email_subject.txt:1
#, python-format
msgid "Password recovery on %(domain)s"
msgstr "პაროლის აღდგენა %(domain)s-ზე"
#: templates/password_reset/recovery_form.html:5
msgid "Password recovery"
msgstr "პაროლის აღდგენა"
#: templates/password_reset/recovery_form.html:11
msgid "Recover my password"
msgstr "ავღადგინო ჩემი პაროლი"
#: templates/password_reset/reset.html:5
#, python-format
msgid ""
"Sorry, this password reset link is invalid. You can still <a href="
"\"%(recovery_url)s\">request a new one</a>."
msgstr ""
"ბოდიში, პაროლის შეცვლის ლინკი არასწორია. თქვენ ისევ შეგიძლიად <a href="
"\"%(recovery_url)s\">ახალი მოითხოვოთ</a>."
#: templates/password_reset/reset.html:7
#, python-format
msgid "Hi, <strong>%(username)s</strong>. Please choose your new password."
msgstr "გამარჯობა, <strong>%(username)s</strong>. გთხოვთ ამოირჩიეთ თქვენი "
"ახალი პაროლი"
#: templates/password_reset/reset.html:11
msgid "Set new password"
msgstr "დავაყენო ახალი პაროლი"
#: templates/password_reset/reset_sent.html:4
msgid "Password recovery sent"
msgstr "პაროლის აღდგენის მოთხოვნა გაგზავნილია"
#: templates/password_reset/reset_sent.html:7
#, python-format
msgid ""
"An email was sent to <strong>%(email)s</strong> %(ago)s ago. Use the link in "
"it to set a new password."
msgstr ""
"email-ი <strong>%(email)s</strong>-ზე იყო გაგზავნილი %(ago)s წინ. მოიხმარეთ ეს "
"ლინკი იმისათვის რომ დააყენოთ ახალი პაროლი"
# django-password-reset translations for ES.
# This file is distributed under the same license as the django-password-reset package.
#
# First author: Gunnar Inge G. Sortland <gunnaringe@gmail.com>, 2014.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-05 20:57+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: forms.py:26
msgid "Username"
msgstr "Brukernavn"
#: forms.py:27
msgid "Email"
msgstr "Epost"
#: forms.py:28
msgid "Username or Email"
msgstr "Brukernavn eller epost"
#: forms.py:51 forms.py:61 forms.py:73
msgid "Sorry, this user doesn't exist."
msgstr "Beklager, denne brukeren eksisterer ikke"
#: forms.py:75
msgid "Unable to find user."
msgstr "Finner ikke brukeren."
#: forms.py:81
msgid "New password"
msgstr "Nytt passord"
#: forms.py:85
msgid "New password (confirm)"
msgstr "Bekreft nytt passord"
#: forms.py:97
msgid "The two passwords didn't match."
msgstr "Passordene er ikke like."
#: templates/password_reset/recovery_done.html:3
#, fuzzy
msgid "New password set"
msgstr "Nytt passord"
#: templates/password_reset/recovery_done.html:6
msgid ""
"Your password has successfully been reset. You can use it right now on the "
"login page."
msgstr ""
"Ditt passord har blitt endret. Du kan nå logge inn med ditt nye passord."
#: templates/password_reset/recovery_email.txt:1
#, python-format
msgid "Dear %(username)s,"
msgstr "Kjære %(username)s,"
#: templates/password_reset/recovery_email.txt:3
#, python-format
msgid ""
"You -- or someone pretending to be you -- has requested a password reset on "
"%(domain)s."
msgstr ""
"Du, eller noen som utgir seg for å være deg, har bedt om et nytt passord for "
"%(domain)s."
#: templates/password_reset/recovery_email.txt:5
msgid "You can set your new password by following this link:"
msgstr "Du kan sette nytt passord ved å følge denne linken:"
#: templates/password_reset/recovery_email.txt:9
msgid ""
"If you don't want to reset your password, simply ignore this email and it "
"will stay unchanged."
msgstr ""
"Hvis du ikke ønsker å bytte passord kan du se bort i fra denne eposten.Ditt "
"passord vil forbli uendret."
#: templates/password_reset/recovery_email_subject.txt:1
#, python-format
msgid "Password recovery on %(domain)s"
msgstr "Glemt passord for %(domain)s"
#: templates/password_reset/recovery_form.html:5
#, fuzzy
msgid "Password recovery"
msgstr "Glemt passord for %(domain)s"
#: templates/password_reset/recovery_form.html:11
#, fuzzy
msgid "Recover my password"
msgstr "Nytt passord"
#: templates/password_reset/reset.html:5
#, python-format
msgid ""
"Sorry, this password reset link is invalid. You can still <a href="
"\"%(recovery_url)s\">request a new one</a>."
msgstr ""
"Beklager, men lenken for bytte av passord er ikke korrekt. <a href="
"\"%(recovery_url)s\">Send forespørsel om ny lenke.</a>."
#: templates/password_reset/reset.html:7
#, python-format
msgid "Hi, <strong>%(username)s</strong>. Please choose your new password."
msgstr "Hei, <strong>%(username)s</strong>. Vennligst velg ditt nye passord."
#: templates/password_reset/reset.html:11
#, fuzzy
msgid "Set new password"
msgstr "Nytt passord"
#: templates/password_reset/reset_sent.html:4
#, fuzzy
msgid "Password recovery sent"
msgstr "Glemt passord for %(domain)s"
#: templates/password_reset/reset_sent.html:7
#, python-format
msgid ""
"An email was sent to <strong>%(email)s</strong> %(ago)s ago. Use the link in "
"it to set a new password."
msgstr ""
"En epost har blitt sendt til <strong>%(email)s</strong> for %(ago)s siden. "
"Bruk den tilsende lenken for å be om et nytt passord."
import datetime
from django.conf import settings
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site, RequestSite
from django.core import signing
from django.core.mail import send_mail
from django.core.urlresolvers import reverse, reverse_lazy
......@@ -51,12 +51,13 @@ class Recover(SaltMixin, generic.FormView):
case_sensitive = True
form_class = PasswordRecoveryForm
template_name = 'password_reset/recovery_form.html'
success_url_name = 'password_reset_sent'
email_template_name = 'password_reset/recovery_email.txt'
email_subject_template_name = 'password_reset/recovery_email_subject.txt'
search_fields = ['username', 'email']
def get_success_url(self):
return reverse('password_reset_sent', args=[self.mail_signature])
return reverse(self.success_url_name, args=[self.mail_signature])
def get_context_data(self, **kwargs):
kwargs['url'] = self.request.get_full_path()
......@@ -70,9 +71,15 @@ class Recover(SaltMixin, generic.FormView):
})
return kwargs
def get_site(self):
if Site._meta.installed:
return Site.objects.get_current()
else:
return RequestSite(self.request)
def send_notification(self):
context = {
'site': RequestSite(self.request),
'site': self.get_site(),
'user': self.user,
'username': get_username(self.user),
'token': signing.dumps(self.user.pk, salt=self.salt),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment