##// END OF EJS Templates
my_account: Remove oauth identities views from my_account controller.
johbo -
r26:3e99070f default
parent child Browse files
Show More
@@ -496,12 +496,6 b' def make_map(config):'
496 m.connect('my_account_auth_tokens', '/my_account/auth_tokens',
496 m.connect('my_account_auth_tokens', '/my_account/auth_tokens',
497 action='my_account_auth_tokens_delete', conditions={'method': ['DELETE']})
497 action='my_account_auth_tokens_delete', conditions={'method': ['DELETE']})
498
498
499 m.connect('my_account_oauth', '/my_account/oauth',
500 action='my_account_oauth', conditions={'method': ['GET']})
501 m.connect('my_account_oauth', '/my_account/oauth',
502 action='my_account_oauth_delete',
503 conditions={'method': ['DELETE']})
504
505 # NOTIFICATION REST ROUTES
499 # NOTIFICATION REST ROUTES
506 with rmap.submapper(path_prefix=ADMIN_PREFIX,
500 with rmap.submapper(path_prefix=ADMIN_PREFIX,
507 controller='admin/notifications') as m:
501 controller='admin/notifications') as m:
@@ -39,16 +39,15 b' from rhodecode.lib.auth import ('
39 from rhodecode.lib.base import BaseController, render
39 from rhodecode.lib.base import BaseController, render
40 from rhodecode.lib.utils2 import safe_int, md5
40 from rhodecode.lib.utils2 import safe_int, md5
41 from rhodecode.lib.ext_json import json
41 from rhodecode.lib.ext_json import json
42 from rhodecode.model.db import (Repository, PullRequest, PullRequestReviewers,
42 from rhodecode.model.db import (
43 UserEmailMap, User, UserFollowing,
43 Repository, PullRequest, PullRequestReviewers, UserEmailMap, User,
44 ExternalIdentity)
44 UserFollowing)
45 from rhodecode.model.forms import UserForm, PasswordChangeForm
45 from rhodecode.model.forms import UserForm, PasswordChangeForm
46 from rhodecode.model.scm import RepoList
46 from rhodecode.model.scm import RepoList
47 from rhodecode.model.user import UserModel
47 from rhodecode.model.user import UserModel
48 from rhodecode.model.repo import RepoModel
48 from rhodecode.model.repo import RepoModel
49 from rhodecode.model.auth_token import AuthTokenModel
49 from rhodecode.model.auth_token import AuthTokenModel
50 from rhodecode.model.meta import Session
50 from rhodecode.model.meta import Session
51 from rhodecode.model.settings import SettingsModel
52
51
53 log = logging.getLogger(__name__)
52 log = logging.getLogger(__name__)
54
53
@@ -347,27 +346,3 b' class MyAccountController(BaseController'
347 h.flash(_("Auth token successfully deleted"), category='success')
346 h.flash(_("Auth token successfully deleted"), category='success')
348
347
349 return redirect(url('my_account_auth_tokens'))
348 return redirect(url('my_account_auth_tokens'))
350
351 def my_account_oauth(self):
352 c.active = 'oauth'
353 self.__load_data()
354 c.user_oauth_tokens = ExternalIdentity().by_local_user_id(
355 c.rhodecode_user.user_id).all()
356 settings = SettingsModel().get_all_settings()
357 c.social_plugins = SettingsModel().list_enabled_social_plugins(
358 settings)
359 return render('admin/my_account/my_account.html')
360
361 @auth.CSRFRequired()
362 def my_account_oauth_delete(self):
363 token = ExternalIdentity.by_external_id_and_provider(
364 request.params.get('external_id'),
365 request.params.get('provider_name'),
366 local_user_id=c.rhodecode_user.user_id
367 )
368 if token:
369 Session().delete(token)
370 Session().commit()
371 h.flash(_("OAuth token successfully deleted"), category='success')
372
373 return redirect(url('my_account_oauth'))
@@ -29,7 +29,11 b''
29 <li class="${'active' if c.active=='profile' or c.active=='profile_edit' else ''}"><a href="${h.url('my_account')}">${_('My Profile')}</a></li>
29 <li class="${'active' if c.active=='profile' or c.active=='profile_edit' else ''}"><a href="${h.url('my_account')}">${_('My Profile')}</a></li>
30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
32 <li class="${'active' if c.active=='oauth' else ''}"><a href="${h.url('my_account_oauth')}">${_('OAuth Identities')}</a></li>
32 ## TODO: Find a better integration of oauth views into navigation.
33 %try:
34 <li class="${'active' if c.active=='oauth' else ''}"><a href="${h.route_path('my_account_oauth')}">${_('OAuth Identities')}</a></li>
35 %except KeyError:
36 %endtry
33 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
37 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
34 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
38 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
35 <li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
39 <li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
General Comments 0
You need to be logged in to leave comments. Login now