Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow up - 4c98b08 - Maintenance: Improve Two-Factor disabled method…
…s handling.
- Loading branch information
Showing
6 changed files
with
47 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
app/assets/javascripts/app/lib/app_post/two_factor_methods.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
class App.TwoFactorMethods | ||
@sortedMethods: -> | ||
all_methods = App.Config.get('TwoFactorMethods') | ||
|
||
_.sortBy all_methods, (elem) -> elem.order | ||
_.sortBy App.Config.get('TwoFactorMethods'), (elem) -> elem.order | ||
|
||
@methodByKey: (key) -> | ||
_.findWhere App.Config.get('TwoFactorMethods'), { key: key } | ||
|
||
@authenticationMethods: -> | ||
_.where @sortedMethods(), { authenticationMethod: true } | ||
|
||
@isAnyAuthenticationMethodEnabled: -> | ||
_.some @authenticationMethods(), (elem) -> App.Config.get(elem.settingKey) |
18 changes: 10 additions & 8 deletions
18
app/assets/javascripts/app/lib/app_post/two_factor_methods/authenticator_app.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
App.Config.set('AuthenticatorApp', { | ||
key: 'authenticator_app' | ||
identifier: 'AuthenticatorApp' | ||
editable: true | ||
label: __('Authenticator App') | ||
description: __('Get the security code from the authenticator app on your device.') | ||
helpMessage: __('Enter the code from your two-factor authenticator app.') | ||
icon: 'mobile-code' | ||
order: 2000 | ||
key: 'authenticator_app' | ||
identifier: 'AuthenticatorApp' | ||
editable: true | ||
label: __('Authenticator App') | ||
description: __('Get the security code from the authenticator app on your device.') | ||
helpMessage: __('Enter the code from your two-factor authenticator app.') | ||
icon: 'mobile-code' | ||
order: 2000 | ||
authenticationMethod: true | ||
settingKey: 'two_factor_authentication_method_authenticator_app' | ||
}, 'TwoFactorMethods') |
16 changes: 9 additions & 7 deletions
16
app/assets/javascripts/app/lib/app_post/two_factor_methods/recovery_codes.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
App.Config.set('RecoveryCodes', { | ||
key: 'recovery_codes' | ||
identifier: 'RecoveryCodes' | ||
label: __('Recovery Codes') | ||
description: __('Use one of your safely stored recovery codes.') | ||
helpMessage: __('Enter one of your unused recovery codes.') | ||
icon: 'mobile-code' | ||
order: 2000 | ||
key: 'recovery_codes' | ||
identifier: 'RecoveryCodes' | ||
label: __('Recovery Codes') | ||
description: __('Use one of your safely stored recovery codes.') | ||
helpMessage: __('Enter one of your unused recovery codes.') | ||
icon: 'mobile-code' | ||
order: 2000 | ||
authenticationMethod: false | ||
settingKey: 'two_factor_authentication_recovery_codes' | ||
}, 'TwoFactorMethods') |
18 changes: 10 additions & 8 deletions
18
app/assets/javascripts/app/lib/app_post/two_factor_methods/security_keys.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
App.Config.set('SecurityKeys', { | ||
key: 'security_keys' | ||
identifier: 'SecurityKeys' | ||
editable: true | ||
label: __('Security Keys') | ||
description: __('Complete the sign-in with your security key.') | ||
helpMessage: __('Complete the sign-in with your security key.') | ||
icon: 'security-key' | ||
order: 1000 | ||
key: 'security_keys' | ||
identifier: 'SecurityKeys' | ||
editable: true | ||
label: __('Security Keys') | ||
description: __('Complete the sign-in with your security key.') | ||
helpMessage: __('Complete the sign-in with your security key.') | ||
icon: 'security-key' | ||
order: 1000 | ||
authenticationMethod: true | ||
settingKey: 'two_factor_authentication_method_security_keys' | ||
}, 'TwoFactorMethods') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters