add Nonce (one-time links), add password reset function (missing e-mail verification), closes #7

This commit is contained in:
Jens Langhammer
2019-02-25 20:46:23 +01:00
parent f2569b6424
commit a0d42092e3
11 changed files with 117 additions and 8 deletions

View File

@ -12,6 +12,7 @@ from django.views.generic import FormView
from passbook.core.auth.factor import AuthenticationFactor
from passbook.core.auth.view import AuthenticationView
from passbook.core.forms.authentication import PasswordFactorForm
from passbook.core.models import Nonce
from passbook.lib.config import CONFIG
LOGGER = getLogger(__name__)
@ -29,7 +30,8 @@ class PasswordFactor(FormView, AuthenticationFactor):
def get(self, request, *args, **kwargs):
if 'password-forgotten' in request.GET:
# TODO: Save nonce key in database for password reset
nonce = Nonce.objects.create(user=self.pending_user)
LOGGER.debug("DEBUG %s", str(nonce.uuid))
# TODO: Send email to user
self.authenticator.cleanup()
messages.success(request, _('Check your E-Mails for a password reset link.'))