diff --git a/users/forms.py b/users/forms.py index 742d4c2..fe99657 100644 --- a/users/forms.py +++ b/users/forms.py @@ -79,11 +79,6 @@ class UserChangeForm(forms.ModelForm): return user -class ResetPasswordForm(forms.Form): - pseudo = forms.CharField(label=u'Pseudo', max_length=255) - email = forms.EmailField(max_length=255) - - class BaseInfoForm(ModelForm): def __init__(self, *args, **kwargs): super(BaseInfoForm, self).__init__(*args, **kwargs) diff --git a/users/urls.py b/users/urls.py index b75132f..1bf6ceb 100644 --- a/users/urls.py +++ b/users/urls.py @@ -32,7 +32,6 @@ urlpatterns = [ url(r'^add_right/(?P[0-9]+)$', views.add_right, name='add-right'), url(r'^del_right/$', views.del_right, name='del-right'), url(r'^process/(?P[a-z0-9]{32})/$', views.process, name='process'), - url(r'^reset_password/$', views.reset_password, name='reset-password'), url(r'^history/(?Puser)/(?P[0-9]+)$', views.history, name='history'), url(r'^history/(?Plistright)/(?P[0-9]+)$', views.history, name='history'), url(r'^$', views.index, name='index'), diff --git a/users/views.py b/users/views.py index bae086a..9530dcd 100644 --- a/users/views.py +++ b/users/views.py @@ -22,7 +22,7 @@ from media.models import Emprunt from users.decorators import user_is_in_campus from users.forms import DelListRightForm, NewListRightForm, ListRightForm, RightForm, DelRightForm from users.forms import InfoForm, BaseInfoForm, StateForm, ClefForm, AdhesionForm -from users.forms import PassForm, ResetPasswordForm +from users.forms import PassForm from users.models import User, Request, ListRight, Right, Clef, Adhesion @@ -513,32 +513,12 @@ def adherer(request, userid): return redirect("/users/profil/" + userid) -def reset_password(request): - userform = ResetPasswordForm(request.POST or None) - if userform.is_valid(): - try: - user = User.objects.get(pseudo=userform.cleaned_data['pseudo'], email=userform.cleaned_data['email']) - except User.DoesNotExist: - messages.error(request, "Cet utilisateur n'existe pas") - return form({'userform': userform}, 'users/user.html', request) - req = Request() - req.type = Request.PASSWD - req.user = user - req.save() - reset_passwd_mail(req, request) - messages.success(request, "Un mail pour l'initialisation du mot de passe a été envoyé") - redirect("/") - return form({'userform': userform}, 'users/user.html', request) - - def process(request, token): valid_reqs = Request.objects.filter(expires_at__gt=timezone.now()) req = get_object_or_404(valid_reqs, token=token) if req.type == Request.PASSWD: return process_passwd(request, req) - elif req.type == Request.EMAIL: - return process_email(request, req=req) else: messages.error(request, "Entrée incorrecte, contactez un admin") redirect("/")