Mercurial > kallithea
changeset 6232:90af0cdf02d8
cleanup: don't check if currently logged-in user exists
Don't check if the currently logged-in User exists. Every request
runs in a database transaction; if the object existed at the start,
it still exists (unless we add a way for a user to delete themselves).
author | Søren Løvborg <sorenl@unity3d.com> |
---|---|
date | Thu, 15 Sep 2016 17:42:59 +0200 |
parents | d1ed15ef8714 |
children | dd6e3441b4f4 |
files | kallithea/controllers/admin/my_account.py |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/my_account.py Wed Sep 14 16:27:05 2016 +0200 +++ b/kallithea/controllers/admin/my_account.py Thu Sep 15 17:42:59 2016 +0200 @@ -255,14 +255,11 @@ def my_account_api_keys_delete(self): api_key = request.POST.get('del_api_key') - user_id = self.authuser.user_id if request.POST.get('del_api_key_builtin'): - user = User.get(user_id) - if user is not None: - user.api_key = generate_api_key() - Session().add(user) - Session().commit() - h.flash(_("API key successfully reset"), category='success') + user = User.get(self.authuser.user_id) + user.api_key = generate_api_key() + Session().commit() + h.flash(_("API key successfully reset"), category='success') elif api_key: ApiKeyModel().delete(api_key, self.authuser.user_id) Session().commit()