From ca01b8c6223257231fb8c337ec5bfe755f3084f2 Mon Sep 17 00:00:00 2001 From: bsimpson63 Date: Tue, 20 Mar 2012 17:24:57 -0700 Subject: [PATCH] Allow users to remove their email address. --- r2/r2/controllers/api.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 02ef94b60..ba1f0e09d 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -645,7 +645,17 @@ class ApiController(RedditController): _("you should be getting a verification email shortly.")) else: form.set_html('.status', _('your email has been updated')) - + + # user is removing their email + if (not email and c.user.email and + form.has_errors("email", errors.NO_EMAILS)): + c.user.email = '' + c.user.email_verified = None + c.user._commit() + Award.take_away("verified_email", c.user) + updated = True + form.set_html('.status', _('your email has been updated')) + # change password if (password and not (form.has_errors("newpass", errors.BAD_PASSWORD) or