##// END OF EJS Templates
feat(2fa): updates routes names and urls to better reflect actions
super-admin -
r5368:4bc46af9 default
parent child Browse files
Show More
@@ -500,7 +500,7 b' class LoginView(BaseAppView):'
500 500 user_instance.set_2fa_secret(secret)
501 501
502 502 Session().commit()
503 raise HTTPFound(self.request.route_path('my_account_enable_2fa', _query={'show-recovery-codes': 1}))
503 raise HTTPFound(self.request.route_path('my_account_configure_2fa', _query={'show-recovery-codes': 1}))
504 504 except formencode.Invalid as errors:
505 505 defaults = errors.value
506 506 render_ctx = {
@@ -76,21 +76,21 b' def includeme(config):'
76 76
77 77 # my account 2fa
78 78 config.add_route(
79 name='my_account_enable_2fa',
80 pattern=ADMIN_PREFIX + '/my_account/enable_2fa')
79 name='my_account_configure_2fa',
80 pattern=ADMIN_PREFIX + '/my_account/configure_2fa')
81 81 config.add_view(
82 82 MyAccountView,
83 83 attr='my_account_2fa',
84 route_name='my_account_enable_2fa', request_method='GET',
84 route_name='my_account_configure_2fa', request_method='GET',
85 85 renderer='rhodecode:templates/admin/my_account/my_account.mako')
86 86 # my account 2fa save
87 87 config.add_route(
88 name='my_account_enable_2fa_save',
89 pattern=ADMIN_PREFIX + '/my_account/enable_2fa_save')
88 name='my_account_configure_2fa_update',
89 pattern=ADMIN_PREFIX + '/my_account/configure_2fa_update')
90 90 config.add_view(
91 91 MyAccountView,
92 92 attr='my_account_2fa_update',
93 route_name='my_account_enable_2fa_save', request_method='POST',
93 route_name='my_account_configure_2fa_update', request_method='POST',
94 94 renderer='rhodecode:templates/admin/my_account/my_account.mako')
95 95
96 96 # my account 2fa recovery code-reset
@@ -231,7 +231,7 b' class MyAccountView(BaseAppView, DataGri'
231 231 user_instance.update_userdata(update_2fa=time.time())
232 232 Session().commit()
233 233 h.flash(_("Successfully saved 2FA settings"), category='success')
234 raise HTTPFound(self.request.route_path('my_account_enable_2fa'))
234 raise HTTPFound(self.request.route_path('my_account_configure_2fa'))
235 235
236 236 @LoginRequired()
237 237 @NotAnonymous()
@@ -262,12 +262,12 b' class MyAccountView(BaseAppView, DataGri'
262 262 Session().commit()
263 263 except formencode.Invalid as errors:
264 264 h.flash(_("Failed to generate new recovery codes: {}").format(errors), category='error')
265 raise HTTPFound(self.request.route_path('my_account_enable_2fa'))
265 raise HTTPFound(self.request.route_path('my_account_configure_2fa'))
266 266 except Exception as e:
267 267 h.flash(_("Failed to generate new recovery codes: {}").format(e), category='error')
268 raise HTTPFound(self.request.route_path('my_account_enable_2fa'))
268 raise HTTPFound(self.request.route_path('my_account_configure_2fa'))
269 269
270 raise HTTPFound(self.request.route_path('my_account_enable_2fa', _query={'show-recovery-codes': 1}))
270 raise HTTPFound(self.request.route_path('my_account_configure_2fa', _query={'show-recovery-codes': 1}))
271 271
272 272 @LoginRequired()
273 273 @NotAnonymous()
@@ -215,12 +215,12 b' function registerRCRoutes() {'
215 215 pyroutes.register('my_account_auth_tokens_view', '/_admin/my_account/auth_tokens/view', []);
216 216 pyroutes.register('my_account_bookmarks', '/_admin/my_account/bookmarks', []);
217 217 pyroutes.register('my_account_bookmarks_update', '/_admin/my_account/bookmarks/update', []);
218 pyroutes.register('my_account_configure_2fa', '/_admin/my_account/configure_2fa', []);
219 pyroutes.register('my_account_configure_2fa_update', '/_admin/my_account/configure_2fa_update', []);
218 220 pyroutes.register('my_account_edit', '/_admin/my_account/edit', []);
219 221 pyroutes.register('my_account_emails', '/_admin/my_account/emails', []);
220 222 pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []);
221 223 pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []);
222 pyroutes.register('my_account_enable_2fa', '/_admin/my_account/enable_2fa', []);
223 pyroutes.register('my_account_enable_2fa_save', '/_admin/my_account/enable_2fa_save', []);
224 224 pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []);
225 225 pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []);
226 226 pyroutes.register('my_account_goto_bookmark', '/_admin/my_account/bookmark/%(bookmark_id)s', ['bookmark_id']);
@@ -28,7 +28,7 b''
28 28 <li class="${h.is_active(['profile', 'profile_edit'], c.active)}"><a href="${h.route_path('my_account_profile')}">${_('Profile')}</a></li>
29 29 <li class="${h.is_active('emails', c.active)}"><a href="${h.route_path('my_account_emails')}">${_('Emails')}</a></li>
30 30 <li class="${h.is_active('password', c.active)}"><a href="${h.route_path('my_account_password')}">${_('Password')}</a></li>
31 <li class="${h.is_active('2FA', c.active)}"><a href="${h.route_path('my_account_enable_2fa')}">${_('2FA')}</a></li>
31 <li class="${h.is_active('2FA', c.active)}"><a href="${h.route_path('my_account_configure_2fa')}">${_('2FA')}</a></li>
32 32 <li class="${h.is_active('bookmarks', c.active)}"><a href="${h.route_path('my_account_bookmarks')}">${_('Bookmarks')}</a></li>
33 33 <li class="${h.is_active('auth_tokens', c.active)}"><a href="${h.route_path('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
34 34 <li class="${h.is_active(['ssh_keys', 'ssh_keys_generate'], c.active)}"><a href="${h.route_path('my_account_ssh_keys')}">${_('SSH Keys')}</a></li>
@@ -4,7 +4,7 b''
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Enable/Disable 2FA for your account')}</h3>
6 6 </div>
7 ${h.secure_form(h.route_path('my_account_enable_2fa_save'), request=request)}
7 ${h.secure_form(h.route_path('my_account_configure_2fa_update'), request=request)}
8 8 <div class="panel-body">
9 9 <div class="form">
10 10 <div class="fields">
@@ -50,7 +50,7 b''
50 50 ${_('Please save them in a safe place, or you will lose access to your account in case of lost access to authenticator app.')}
51 51 </p>
52 52 <br/>
53 <a href="${request.route_path('my_account_enable_2fa', _query={'show-recovery-codes': 1})}" class="btn btn-primary">${_('Show recovery codes')}</a>
53 <a href="${request.route_path('my_account_configure_2fa', _query={'show-recovery-codes': 1})}" class="btn btn-primary">${_('Show recovery codes')}</a>
54 54 </div>
55 55 </div>
56 56 % endif
General Comments 0
You need to be logged in to leave comments. Login now