my_account: Remove oauth identities views from my_account controller.
This commit is contained in:
parent
9deeea15fe
commit
3bfdc11350
3 changed files with 8 additions and 35 deletions
|
|
@ -496,12 +496,6 @@ def make_map(config):
|
|||
m.connect('my_account_auth_tokens', '/my_account/auth_tokens',
|
||||
action='my_account_auth_tokens_delete', conditions={'method': ['DELETE']})
|
||||
|
||||
m.connect('my_account_oauth', '/my_account/oauth',
|
||||
action='my_account_oauth', conditions={'method': ['GET']})
|
||||
m.connect('my_account_oauth', '/my_account/oauth',
|
||||
action='my_account_oauth_delete',
|
||||
conditions={'method': ['DELETE']})
|
||||
|
||||
# NOTIFICATION REST ROUTES
|
||||
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
||||
controller='admin/notifications') as m:
|
||||
|
|
|
|||
|
|
@ -39,16 +39,15 @@ from rhodecode.lib.auth import (
|
|||
from rhodecode.lib.base import BaseController, render
|
||||
from rhodecode.lib.utils2 import safe_int, md5
|
||||
from rhodecode.lib.ext_json import json
|
||||
from rhodecode.model.db import (Repository, PullRequest, PullRequestReviewers,
|
||||
UserEmailMap, User, UserFollowing,
|
||||
ExternalIdentity)
|
||||
from rhodecode.model.db import (
|
||||
Repository, PullRequest, PullRequestReviewers, UserEmailMap, User,
|
||||
UserFollowing)
|
||||
from rhodecode.model.forms import UserForm, PasswordChangeForm
|
||||
from rhodecode.model.scm import RepoList
|
||||
from rhodecode.model.user import UserModel
|
||||
from rhodecode.model.repo import RepoModel
|
||||
from rhodecode.model.auth_token import AuthTokenModel
|
||||
from rhodecode.model.meta import Session
|
||||
from rhodecode.model.settings import SettingsModel
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -347,27 +346,3 @@ class MyAccountController(BaseController):
|
|||
h.flash(_("Auth token successfully deleted"), category='success')
|
||||
|
||||
return redirect(url('my_account_auth_tokens'))
|
||||
|
||||
def my_account_oauth(self):
|
||||
c.active = 'oauth'
|
||||
self.__load_data()
|
||||
c.user_oauth_tokens = ExternalIdentity().by_local_user_id(
|
||||
c.rhodecode_user.user_id).all()
|
||||
settings = SettingsModel().get_all_settings()
|
||||
c.social_plugins = SettingsModel().list_enabled_social_plugins(
|
||||
settings)
|
||||
return render('admin/my_account/my_account.html')
|
||||
|
||||
@auth.CSRFRequired()
|
||||
def my_account_oauth_delete(self):
|
||||
token = ExternalIdentity.by_external_id_and_provider(
|
||||
request.params.get('external_id'),
|
||||
request.params.get('provider_name'),
|
||||
local_user_id=c.rhodecode_user.user_id
|
||||
)
|
||||
if token:
|
||||
Session().delete(token)
|
||||
Session().commit()
|
||||
h.flash(_("OAuth token successfully deleted"), category='success')
|
||||
|
||||
return redirect(url('my_account_oauth'))
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@
|
|||
<li class="${'active' if c.active=='profile' or c.active=='profile_edit' else ''}"><a href="${h.url('my_account')}">${_('My Profile')}</a></li>
|
||||
<li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
|
||||
<li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
|
||||
<li class="${'active' if c.active=='oauth' else ''}"><a href="${h.url('my_account_oauth')}">${_('OAuth Identities')}</a></li>
|
||||
## TODO: Find a better integration of oauth views into navigation.
|
||||
%try:
|
||||
<li class="${'active' if c.active=='oauth' else ''}"><a href="${h.route_path('my_account_oauth')}">${_('OAuth Identities')}</a></li>
|
||||
%except KeyError:
|
||||
%endtry
|
||||
<li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
|
||||
<li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
|
||||
<li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue