diff --git a/rhodecode/controllers/admin/my_account.py b/rhodecode/controllers/admin/my_account.py --- a/rhodecode/controllers/admin/my_account.py +++ b/rhodecode/controllers/admin/my_account.py @@ -408,17 +408,10 @@ class MyAccountController(BaseController @auth.CSRFRequired() def my_account_auth_tokens_delete(self): - auth_token = request.POST.get('del_auth_token') - user_id = c.rhodecode_user.user_id - if request.POST.get('del_auth_token_builtin'): - user = User.get(user_id) - if user: - user.api_key = generate_auth_token(user.username) - Session().add(user) - Session().commit() - h.flash(_("Auth token successfully reset"), category='success') - elif auth_token: - AuthTokenModel().delete(auth_token, c.rhodecode_user.user_id) + del_auth_token = request.POST.get('del_auth_token') + + if del_auth_token: + AuthTokenModel().delete(del_auth_token, c.rhodecode_user.user_id) Session().commit() h.flash(_("Auth token successfully deleted"), category='success') diff --git a/rhodecode/controllers/admin/users.py b/rhodecode/controllers/admin/users.py --- a/rhodecode/controllers/admin/users.py +++ b/rhodecode/controllers/admin/users.py @@ -507,16 +507,9 @@ class UsersController(BaseController): h.flash(_("You can't edit this user"), category='warning') return redirect(url('users')) - auth_token = request.POST.get('del_auth_token') - if request.POST.get('del_auth_token_builtin'): - user = User.get(c.user.user_id) - if user: - user.api_key = generate_auth_token(user.username) - Session().add(user) - Session().commit() - h.flash(_("Auth token successfully reset"), category='success') - elif auth_token: - AuthTokenModel().delete(auth_token, c.user.user_id) + del_auth_token = request.POST.get('del_auth_token') + if del_auth_token: + AuthTokenModel().delete(del_auth_token, c.user.user_id) Session().commit() h.flash(_("Auth token successfully deleted"), category='success') diff --git a/rhodecode/lib/dbmigrate/schema/db_4_7_0_0.py b/rhodecode/lib/dbmigrate/schema/db_4_7_0_0.py --- a/rhodecode/lib/dbmigrate/schema/db_4_7_0_0.py +++ b/rhodecode/lib/dbmigrate/schema/db_4_7_0_0.py @@ -649,13 +649,6 @@ class User(Base, BaseModel): return False @property - def builtin_token_roles(self): - roles = [ - UserApiKeys.ROLE_API, UserApiKeys.ROLE_FEED, UserApiKeys.ROLE_HTTP - ] - return map(UserApiKeys._get_role_name, roles) - - @property def ip_addresses(self): ret = UserIpMap.query().filter(UserIpMap.user == self).all() return [x.ip_addr for x in ret] diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -644,13 +644,6 @@ class User(Base, BaseModel): return False @property - def builtin_token_roles(self): - roles = [ - UserApiKeys.ROLE_API, UserApiKeys.ROLE_FEED, UserApiKeys.ROLE_HTTP - ] - return map(UserApiKeys._get_role_name, roles) - - @property def ip_addresses(self): ret = UserIpMap.query().filter(UserIpMap.user == self).all() return [x.ip_addr for x in ret] diff --git a/rhodecode/templates/admin/my_account/my_account_auth_tokens.mako b/rhodecode/templates/admin/my_account/my_account_auth_tokens.mako --- a/rhodecode/templates/admin/my_account/my_account_auth_tokens.mako +++ b/rhodecode/templates/admin/my_account/my_account_auth_tokens.mako @@ -4,35 +4,9 @@
- ${_('Built-in tokens can be used to authenticate with all possible options.')}
${_('Each token can have a role. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations.')}
- | - ${_('Built-in')} - | -- % for token in c.user.builtin_token_roles: - - ${token} - - % endfor - | -${_('expires')}: ${_('never')} | -- ${h.secure_form(url('my_account_auth_tokens'),method='delete')} - ${h.hidden('del_auth_token',c.user.api_key)} - ${h.hidden('del_auth_token_builtin',1)} - - ${h.end_form()} - | -
- | - ${_('Built-in')} - | -- % for token in c.user.builtin_token_roles: - - ${token} - - % endfor - | -${_('expires')}: ${_('never')} | -- ${h.secure_form(url('edit_user_auth_tokens', user_id=c.user.user_id),method='delete')} - ${h.hidden('del_auth_token',c.user.api_key)} - ${h.hidden('del_auth_token_builtin',1)} - - ${h.end_form()} - | -