Projet

Général

Profil

Development #5223

Remove use of django-registration

Ajouté par Serghei Mihai il y a presque 10 ans. Mis à jour il y a environ 9 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
25 juillet 2014
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:

Description

Actuellement l'enregistrement des nouveaux utilisateurs se passe dans une vue héritant de registration et l'activation du compte utilisateur se fait directement via une vue registration.

Pourrait-on déleguer tout le travail de création et activation aux vues de registration?
Si besoin, coder notre backend si nous avons des checks spécifiques à faire les utilisateurs.

Je le vois dans l'optique de pouvoir changer facilement de backend d'enregistrement, de default à ldap par exemple, en chargeant les vues correspondantes, en fonction d'une variable dans les settings par exemple.


Fichiers

0001-django-registration-dependency-removed-with-however-.patch (33,2 ko) 0001-django-registration-dependency-removed-with-however-.patch Serghei Mihai, 09 septembre 2014 14:56
0001-Registration-process-refactored-django-registration-.patch (14,5 ko) 0001-Registration-process-refactored-django-registration-.patch Serghei Mihai, 11 septembre 2014 10:10
0002-urls-not-involved-in-registration-process-removed-fr.patch (6,47 ko) 0002-urls-not-involved-in-registration-process-removed-fr.patch Serghei Mihai, 11 septembre 2014 10:10
0003-automatically-authenticating-user-on-account-activat.patch (2 ko) 0003-automatically-authenticating-user-on-account-activat.patch Serghei Mihai, 11 septembre 2014 10:10
0001-useless-data-removed-from-emailing-context.patch (835 octets) 0001-useless-data-removed-from-emailing-context.patch Serghei Mihai, 11 septembre 2014 10:50
0001-user-data-passed-directly-to-activate-email-template.patch (1,01 ko) 0001-user-data-passed-directly-to-activate-email-template.patch Serghei Mihai, 11 septembre 2014 15:45
0002-django.contrib.sites-removed-from-registration-backe.patch (2,82 ko) 0002-django.contrib.sites-removed-from-registration-backe.patch Serghei Mihai, 11 septembre 2014 15:45
0001-Registration-process-refactored-django-registration-.patch (14,4 ko) 0001-Registration-process-refactored-django-registration-.patch Serghei Mihai, 16 septembre 2014 14:19
0002-urls-not-involved-in-registration-process-removed-fr.patch (6,47 ko) 0002-urls-not-involved-in-registration-process-removed-fr.patch Serghei Mihai, 16 septembre 2014 14:19
0003-automatically-authenticating-user-on-account-activat.patch (2 ko) 0003-automatically-authenticating-user-on-account-activat.patch Serghei Mihai, 16 septembre 2014 14:19
0004-user-data-passed-directly-to-activate-email-template.patch (1,01 ko) 0004-user-data-passed-directly-to-activate-email-template.patch Serghei Mihai, 16 septembre 2014 14:19
0005-django.contrib.sites-removed-from-registration-backe.patch (2,82 ko) 0005-django.contrib.sites-removed-from-registration-backe.patch Serghei Mihai, 16 septembre 2014 14:19
0006-next_url-param-propagated-from-service-provider-to-r.patch (5,04 ko) 0006-next_url-param-propagated-from-service-provider-to-r.patch Serghei Mihai, 16 septembre 2014 14:19

Historique

#1

Mis à jour par Serghei Mihai il y a plus de 9 ans

J'avais oublié de le poster.

#2

Mis à jour par Frédéric Péters il y a plus de 9 ans

I wonder what's the point of moving things in a default/ subdirectory; it made sense in django-registration as it wanted to be a generic application catering for many different usecases but I don't see that reason applying to Authentic.

#3

Mis à jour par Serghei Mihai il y a plus de 9 ans

The idea is to add, later, another registration backend, let's say "ldap", putting its views and stuff under "ldap" directory.
It could be activated then by changing the A2_REGISTRATION_BACKEND to "ldap".

#4

Mis à jour par Frédéric Péters il y a plus de 9 ans

This is only my opinion but I'd rather not have abstractions created before proven necessary.

Anyway, this patch does two very different things: 1) remove the dependency on django-registration, 2) move things around to create some kind of abstraction (broken in my opinion); this shouldn't be done in a single commit (in my opinion).

#5

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

Just to add my opinion to Fred's. I was thinking that we could start from a clean page instead of copying django-registration in authentic.

First I would move account management view from the urls.py of registration_backend to the main urls.py as it's not related to registration. Then I would rewrite a simple registration backend that would:
  • not create models before activation (maybe using signed URLs1).
  • login user at activation
  • finish login workflow if account creation was initiated in the middle of something going on (see #2803)

[1]: https://docs.djangoproject.com/en/dev/topics/signing/

#6

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

Another requirement could be to check for email unicity at registration and activation.

#7

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

  • Sujet changé de Utilisation de python-django-registration à Remove use of django-registration
#8

Mis à jour par Frédéric Péters il y a plus de 9 ans

As I closed #5263 as a duplicate; here are some additional notes that were written over there:

At least, considering certivox, it would need an additional hook at the "user signs up" step, to validate that the request is ok.

Another requirement for a rewrite of this is that the "next" parameter of the login page should be conserved through the whole registration process so that the registration workflow at the IdP can be integrated into the login workflow of any service provider.

In a discussion about Vincennes, it was noted they would like the possibility to have an email sent to the site admins whenever a new user registers.

#10

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

This does not seem good:

                    'user': form.cleaned_data,
#11

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

On activation page there should be a link to the homepage, the link URL will be replaced by next_url in #2803. #2803 should be simpler to implement now that we send the full registration informations to the user.

#12

Mis à jour par Serghei Mihai il y a plus de 9 ans

Benjamin Dauvergne a écrit :

This does not seem good:
[...]

Indeed. I did not check if user attributes were used in activation email templates.

#13

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

I think that passing the form data to the template is ok, just don't call it user, maybe you could just do ctx_dict.update(cleaned_data).

Also Authentic2 do not use the django.contrib.sites application anymore, we just pass the the site hostname instead.

#15

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

On pourrait avoir la série de patch complète rebasée ?

#17

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

  • Patch proposed changé de Oui à Non
We decided in a recent meeting that the current registration process should be split:
  • first validation (mail, invitation number, whatever.. for now now we will only handle mail validation)
  • then registration

The validation view should ask for the mail and send the activation mail, the activation URL would target the registration view which would verify the token passed in the activation URL.

The patch set should be rewritten in this way. It will improve security as the password will not be included in the activation URL (included in the activation mail) anymore.

#18

Mis à jour par Benjamin Dauvergne il y a plus de 9 ans

Another requirement for the new registration backend, some SMTP server are a bit too restrictive on what email they accept (see https://sentry.entrouvert.org/montpellier/compte-agglo-montpellier-prod/group/831/) we need to handle the exceptions that send_mail() can raise, log a warning and show a humanly understandable error message in this case.

#19

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Statut changé de Nouveau à Solution déployée

It has been pushed.

commit efa4305df0c67f1fdea6c6d018bebafd6e7d9b3d
Author: Serghei MIHAI <smihai@entrouvert.com>
Date:   Tue Nov 18 17:23:26 2014 +0100

    Registration refactored: email validation done first and registration process
    finished on profile completion.

    django-registration removed

commit 717c7ee65daef95805a8a9
#20

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Version cible mis à 2.1.12
#21

Mis à jour par Benjamin Dauvergne il y a environ 9 ans

  • Statut changé de Solution déployée à Fermé

Formats disponibles : Atom PDF