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