Revert "Add back POST_update for API clients."

This reverts commit 605fa72772fa84b9245498f817cdc6d872ab3bdd.

This endpoint has had no significant traffic for months, and should be
safe to remove again at this point.
This commit is contained in:
Chad Birch
2015-01-06 17:02:06 -07:00
parent 159cb9f600
commit 5c4f80d6ee

View File

@@ -1217,80 +1217,6 @@ class ApiController(RedditController):
# invalidated. drop a new cookie.
self.login(c.user)
@validatedForm(VUser('curpass', default = ''),
VModhash(),
email = ValidEmails("email", num = 1),
password = VPasswordChange(['newpass', 'verpass']),
verify = VBoolean("verify"),
dest=VDestination())
@api_doc(api_section.account)
def POST_update(self, form, jquery, email, password, verify, dest):
"""
Update account email address and password.
Called by /prefs/update on the site. For frontend form verification
purposes, `newpass` and `verpass` must be equal for a password change
to succeed.
"""
# password is required to proceed
if form.has_errors("curpass", errors.WRONG_PASSWORD):
return
# check if the email is valid. If one is given and it is
# different from the current address (or there is not one
# currently) apply it
updated = False
if (not form.has_errors("email", errors.BAD_EMAILS) and
email):
if (not hasattr(c.user,'email') or c.user.email != email):
if c.user.email:
emailer.email_change_email(c.user)
c.user.set_email(email)
# unverified email for now
c.user.email_verified = None
c.user._commit()
Award.take_away("verified_email", c.user)
updated = True
if verify:
# TODO: rate limit this?
if dest == '/':
dest = None
emailer.verify_email(c.user, dest=dest)
form.set_text('.status',
_("you should be getting a verification email shortly."))
else:
form.set_text('.status', _('your email has been updated'))
# user is removing their email
if (not email and c.user.email and
(errors.NO_EMAILS, 'email') in c.errors):
c.errors.remove((errors.NO_EMAILS, 'email'))
c.user.set_email('')
c.user.email_verified = None
c.user._commit()
Award.take_away("verified_email", c.user)
updated = True
form.set_text('.status', _('your email has been updated'))
# change password
if (password and
not (form.has_errors("newpass", errors.BAD_PASSWORD) or
form.has_errors("verpass", errors.BAD_PASSWORD_MATCH))):
change_password(c.user, password)
if c.user.email:
emailer.password_change_email(c.user)
if updated:
form.set_text(".status",
_('your email and password have been updated'))
else:
form.set_text('.status',
_('your password has been updated'))
form.set_inputs(curpass = "", newpass = "", verpass = "")
# the password has changed, so the user's cookie has been
# invalidated. drop a new cookie.
self.login(c.user)
@validatedForm(VUser(),
VModhash(),
delete_message = VLength("delete_message", max_length=500),