[PATCH 2/5] Allow changing primary email address for accounts

Finucane, Stephen stephen.finucane at intel.com
Tue Dec 22 03:20:43 AEDT 2015


On 10 Nov 21:53, Bernhard Reutner-Fischer wrote:
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

Happy Christmas :) I rebased this and it seems to do what it says on
the tin...with one exception. Could you have a look?

[snip]

> + at login_required
> +def userdata(request, user_id):
> +    if request.method == 'POST':
> +        user = request.user
> +        old_email = user.email
> +        form = UpdateUserForm(request.POST, instance = user)
> +        if form.is_valid():
> +            email = form.clean_email()
> +            form.save()
> +            conf = EmailConfirmation.objects.get(user_id = user_id,
> +                    type = 'registration',
> +                    email = old_email)
> +            dups = EmailConfirmation.objects.filter(user_id = user_id,
> +                    email = email)
> +            dups.delete() # maybe just if dups.exists() but another roundtrip..
> +            conf.email = email
> +            conf.key = ''
> +            conf.save()
> +            person = get_object_or_404(Person, user_id = user_id,
> +                        email__iexact = old_email)
> +            dups = Person.objects.filter(user_id = user_id,
> +                        email__iexact = email).count()
> +            if dups:
> +                person.delete()
> +            else:
> +                person.email = email
> +                person.save()

[snip]

I'm not sure about the second part of this change. The change is
supposed to allow changing of email (and name) on a User object, so
I don't know why we're touching the Person object. This seems to
change the email associated with a patch which would mean these
patches are now going to reference the new email when downloading
them or whatnot. I'm not really sure if we want to break the
integrity of this data? For example, a patch I sent under my
personal email should remain "authored" by that email, regardless
of what email I'm now using for patchwork login.

Cheers,
Stephen


More information about the Patchwork mailing list