diff options
author | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-04-21 22:23:17 -0400 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-22 04:23:17 +0200 |
commit | 67dea31b0f83eb711bbd49a7b893d04ca16c56fa (patch) | |
tree | 9dacc52579735eaabefe5c2f7fec803e015ff977 /config | |
parent | 6af21daac9f5ed3932694b211a04a715a348d995 (diff) |
2FA controller cleanup (#2296)
* Add spec coverage for settings/two_factor_auth area * extract setup method for qr code * Move otp required check to before action * Merge method only used once * Remove duplicate view * Consolidate creation of @codes for backup * Move settings/2fq#recovery_codes to settings/recovery_codes#create * Rename settings/two_factor_auth#disable to #destroy * Add coverage for the otp required path on 2fa#show * Clean up the recovery codes list styles * Move settings/two_factor_auth to settings/two_factor_authentication * Reorganize the settings two factor auth area Updated to use a flow like: - settings/two_factor_authentication goes to a #show view which has a button either enable or disable 2fa on the account - the disable button turns off the otp requirement for the user - the enable button cycles the user secret and redirects to a confirmation page - the confirmation page is a #new view which shows the QR code for user - that page posts to #create which verifies the code, and creates the recovery codes - that create action shares a view with a recovery codes controller which can be used separately to reset codes if needed
Diffstat (limited to 'config')
-rw-r--r-- | config/locales/bg.yml | 4 | ||||
-rw-r--r-- | config/locales/en.yml | 4 | ||||
-rw-r--r-- | config/locales/eo.yml | 4 | ||||
-rw-r--r-- | config/locales/es.yml | 4 | ||||
-rw-r--r-- | config/locales/fi.yml | 4 | ||||
-rw-r--r-- | config/locales/fr.yml | 4 | ||||
-rw-r--r-- | config/locales/hr.yml | 4 | ||||
-rw-r--r-- | config/locales/id.yml | 4 | ||||
-rw-r--r-- | config/locales/io.yml | 4 | ||||
-rw-r--r-- | config/locales/it.yml | 4 | ||||
-rw-r--r-- | config/locales/ja.yml | 4 | ||||
-rw-r--r-- | config/locales/nl.yml | 4 | ||||
-rw-r--r-- | config/locales/no.yml | 4 | ||||
-rw-r--r-- | config/locales/oc.yml | 4 | ||||
-rw-r--r-- | config/locales/pl.yml | 4 | ||||
-rw-r--r-- | config/locales/ru.yml | 4 | ||||
-rw-r--r-- | config/locales/zh-CN.yml | 4 | ||||
-rw-r--r-- | config/locales/zh-HK.yml | 4 | ||||
-rw-r--r-- | config/locales/zh-TW.yml | 4 | ||||
-rw-r--r-- | config/navigation.rb | 2 | ||||
-rw-r--r-- | config/routes.rb | 9 |
21 files changed, 43 insertions, 44 deletions
diff --git a/config/locales/bg.yml b/config/locales/bg.yml index f751c81a5..4d8c59eb8 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -139,7 +139,7 @@ bg: import: Импортиране preferences: Предпочитания settings: Настройки - two_factor_auth: Двустепенно удостоверяване + two_factor_authentication: Двустепенно удостоверяване statuses: open_in_web: Отвори в уеб over_character_limit: прехвърлен лимит от %{max} символа @@ -155,7 +155,7 @@ bg: time: formats: default: "%d %b, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: При активация на <strong>двустепенно удостоверяване</strong>, за да влезеш в приложението, ще трябва да използваш телефона си. През него ще се генерира код, който да въвеждаш при влизане. disable: Деактивирай enable: Активирай diff --git a/config/locales/en.yml b/config/locales/en.yml index c1438134f..cf492e117 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -277,7 +277,7 @@ en: import: Import preferences: Preferences settings: Settings - two_factor_auth: Two-factor Authentication + two_factor_authentication: Two-factor Authentication statuses: open_in_web: Open in web over_character_limit: character limit of %{max} exceeded @@ -293,7 +293,7 @@ en: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: Enter the code generated by your authenticator app to confirm description_html: If you enable <strong>two-factor authentication</strong>, logging in will require you to be in possession of your phone, which will generate tokens for you to enter. disable: Disable diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 692fcc43a..7b36f3977 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -134,7 +134,7 @@ eo: import: Alporti preferences: Preferoj settings: Agordoj - two_factor_auth: Dufaktora aŭtentigo + two_factor_authentication: Dufaktora aŭtentigo statuses: open_in_web: Malfermi retumile over_character_limit: limo de %{max} signoj trapasita @@ -150,7 +150,7 @@ eo: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: Se vi ebligas <strong>dufaktoran aŭtentigon</strong>, vi bezonos vian poŝtelefonon por ensaluti, ĉar ĝi kreos nombrojn, kiujn vi devos entajpi. disable: Malebligi enable: Ebligi diff --git a/config/locales/es.yml b/config/locales/es.yml index e99c592ff..60739c98d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -139,7 +139,7 @@ es: import: Importar preferences: Preferencias settings: Ajustes - two_factor_auth: Autenticación de dos factores + two_factor_authentication: Autenticación de dos factores statuses: open_in_web: Abrir en web over_character_limit: Límite de caracteres de %{max} superado @@ -155,7 +155,7 @@ es: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: Sí habilitas la <strong>autenticación de dos factores</strong>, se requerirá estar en posesión de su teléfono, lo que generará tokens para que usted pueda iniciar sesión. disable: Deshabilitar enable: Habilitar diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 3d5e240af..1694cb761 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -134,7 +134,7 @@ fi: import: Tuo dataa preferences: Ominaisuudet settings: Asetukset - two_factor_auth: Kaksivaiheinen tunnistus + two_factor_authentication: Kaksivaiheinen tunnistus statuses: open_in_web: Avaa webissä over_character_limit: sallittu kirjanmäärä %{max} ylitetty @@ -150,7 +150,7 @@ fi: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: Jos otat käyttöön <strong>kaksivaiheisen tunnistuksen</stron>, kirjautumiseen vaaditaan puhelin, joka voi luoda tokeneita kirjautumista varten. disable: Poista käytöstä enable: Ota käyttöön diff --git a/config/locales/fr.yml b/config/locales/fr.yml index bd67b4409..03e5abd64 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -273,7 +273,7 @@ fr: import: Import de données preferences: Préférences settings: Réglages - two_factor_auth: Identification à deux facteurs (Two-factor auth) + two_factor_authentication: Identification à deux facteurs (Two-factor auth) statuses: open_in_web: Ouvrir sur le web over_character_limit: limite de caractères dépassée de %{max} caractères @@ -289,7 +289,7 @@ fr: time: formats: default: "%d %b %Y, %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: Entrez le code généré par votre application pour confirmer description_html: Si vous activez <strong>l'identification à deux facteurs</strong>, vous devrez être en possession de votre téléphone afin de générer un code de connexion. disable: Désactiver diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 598cf8ecc..bd137af26 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -136,7 +136,7 @@ hr: import: Uvezi preferences: Postavke settings: Podešenja - two_factor_auth: Dvo-faktorska Autentifikacija + two_factor_authentication: Dvo-faktorska Autentifikacija statuses: open_in_web: Otvori na webu over_character_limit: prijeđen je limit od %{max} znakova @@ -152,7 +152,7 @@ hr: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: Ako omogućiš <strong>dvo-faktorsku autentifikaciju</strong>, prijavljivanje će zahtjevati da kod sebe imaš svoj mobitel, koji će generirati tokene koje ćeš unijeti. disable: Onemogući enable: Omogući diff --git a/config/locales/id.yml b/config/locales/id.yml index 2ddf982c0..2ebe68062 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -250,7 +250,7 @@ id: import: Impor preferences: Pilihan settings: Pengaturan - two_factor_auth: Autentikasi Two-factor + two_factor_authentication: Autentikasi Two-factor statuses: open_in_web: Buka di web over_character_limit: melebihi %{max} karakter @@ -266,7 +266,7 @@ id: time: formats: default: "%d %b %Y, %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: Masukkan kode yang dibuat oleh app autentikator sebagai konfirmasi description_html: Jika anda menaktifkan ototentikasi dua faktor, saat login anda harus menggunakan telepon anda untuk membuat token supaya anda bisa masuk. disable: Matikan diff --git a/config/locales/io.yml b/config/locales/io.yml index b4b1ce61f..98a7be3dc 100644 --- a/config/locales/io.yml +++ b/config/locales/io.yml @@ -276,7 +276,7 @@ io: import: Importacar preferences: Preferi settings: Settings - two_factor_auth: Dufaktora autentikigo + two_factor_authentication: Dufaktora autentikigo statuses: open_in_web: Apertar retnavigile over_character_limit: limito de %{max} signi ecesita @@ -292,7 +292,7 @@ io: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: Enter the code generated by your authenticator app to confirm description_html: Se tu posibligas <strong>dufaktora autentikigo</strong>, tu bezonos tua poshtelefonilo por enirar, nam ol kreos nombri, quin tu devos enskribar. disable: Extingar diff --git a/config/locales/it.yml b/config/locales/it.yml index 0ace8a76a..a841df284 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -140,7 +140,7 @@ it: import: Importa preferences: Preferenze settings: Impostazioni - two_factor_auth: Autenticazione a Due Fattori + two_factor_authentication: Autenticazione a Due Fattori statuses: open_in_web: Apri sul Web over_character_limit: Limite caratteri superato di %{max} @@ -156,7 +156,7 @@ it: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: Inserisci il codice generato dalla tua app di autenticazione description_html: Se abiliti <strong>l'autorizzazione a due fattori</strong>, entrare nel tuo account ti richiederà di avere vicino il tuo telefono, il quale ti genererà un codice per eseguire l'accesso. disable: Disabilita diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 47b86b38e..996067654 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -276,7 +276,7 @@ ja: import: データのインポート preferences: ユーザー設定 settings: 設定 - two_factor_auth: 二段階認証 + two_factor_authentication: 二段階認証 statuses: open_in_web: Webで開く over_character_limit: 上限は %{max}文字までです @@ -292,7 +292,7 @@ ja: time: formats: default: "%Y年%m月%d日 %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: 確認するには認証アプリで表示されたコードを入力してください description_html: "<strong>二段階認証</strong>を有効にするとログイン時、電話でコードを受け取る必要があります。" disable: 無効 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 543acbdfe..5dc398dc6 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -137,7 +137,7 @@ nl: import: Import preferences: Voorkeuren settings: Instellingen - two_factor_auth: Tweestapsverificatie + two_factor_authentication: Tweestapsverificatie statuses: open_in_web: Openen in web over_character_limit: Limiet van %{max} tekens overschreden @@ -153,7 +153,7 @@ nl: time: formats: default: "%d %B %J om %U:%M" - two_factor_auth: + two_factor_authentication: description_html: Na het instellen van <strong>tweestapsverificatie</strong>, kun jij je alleen aanmelden als je jouw mobiele telefoon bij je hebt. Hiermee genereer je namelijk de in te voeren aanmeldcode. disable: Uitschakelen enable: Inschakelen diff --git a/config/locales/no.yml b/config/locales/no.yml index 41a55c6e6..1b0648795 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -134,7 +134,7 @@ import: Importér preferences: Preferanser settings: Innstillinger - two_factor_auth: Tofaktorautentisering + two_factor_authentication: Tofaktorautentisering statuses: open_in_web: Åpne i nettleser over_character_limit: grense på %{max} tegn overskredet @@ -150,7 +150,7 @@ time: formats: default: "%d, %b %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: Hvis du skrur på <strong>tofaktorautentisering</strong> må du ha din telefon for å logge inn. Denne vil generere koder som du må taste inn. disable: Skru av enable: Skru på diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 46e32d8d3..dc345d0d8 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -292,7 +292,7 @@ oc: import: Import preferences: Preferéncias settings: Paramètres - two_factor_auth: Autentificacion en dos temps + two_factor_authentication: Autentificacion en dos temps statuses: open_in_web: Dobrir sul web over_character_limit: limit de %{max} caractèrs passat @@ -308,7 +308,7 @@ oc: time: formats: default: "%b %d %Y a %H o %M" - two_factor_auth: + two_factor_authentication: code_hint: Enter the code generated by your authenticator app to confirm description_html: S’activatz <strong> l’autentificacion two-factor</strong>, vos caldrà vòstre mobil per vos connectar perque generarà un geton per vos daissar diff --git a/config/locales/pl.yml b/config/locales/pl.yml index f213f3249..0242b7ca7 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -134,7 +134,7 @@ pl: import: Importuj dane preferences: Preferencje settings: Ustawienia - two_factor_auth: Uwierzytelnianie dwuetapowe + two_factor_authentication: Uwierzytelnianie dwuetapowe statuses: open_in_web: Otwórz w przeglądarce over_character_limit: limit %{max} znaków przekroczony @@ -150,7 +150,7 @@ pl: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: description_html: Jeśli włączysz <strong>uwierzytelnianie dwustopniowe</strong>, logowanie się będzie wymagało podania tokenu wyświetlonego na Twoim telefone. disable: Wyłącz enable: Włącz diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 3d1869ebd..532e3dc07 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -267,7 +267,7 @@ ru: import: Импорт preferences: Настройки settings: Опции - two_factor_auth: Двухфакторная аутентификация + two_factor_authentication: Двухфакторная аутентификация statuses: open_in_web: Открыть в WWW over_character_limit: превышен лимит символов (%{max}) @@ -283,7 +283,7 @@ ru: time: formats: default: "%b %d, %Y, %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: Для подтверждения введите код, сгенерированный приложением аутентификатора description_html: При включении <strong>двухфакторной аутентификации</strong>, вход потребует от Вас использования Вашего телефона, который сгенерирует входные токены. disable: Отключить diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index e11e68788..f89a3ecb6 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -269,7 +269,7 @@ zh-CN: export: 数据导出 preferences: 首选项 settings: 设置 - two_factor_auth: 两步认证 + two_factor_authentication: 两步认证 statuses: # Hey, this is already in a web browser! open_in_web: 打开网页 @@ -286,7 +286,7 @@ zh-CN: time: formats: default: "%Y年%-m月%d日 %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: 请输入你认证器产生的代码,以确认设置 description_html: 当你启用<strong>两步认证</strong>后,你登录时将额外需要使用手机或其他认证器生成的代码。 disable: 停用 diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index 289c9445a..147385fad 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -276,7 +276,7 @@ zh-HK: import: 匯入 preferences: 偏好設定 settings: 設定 - two_factor_auth: 雙重認證 + two_factor_authentication: 雙重認證 statuses: open_in_web: 開啟網頁 over_character_limit: 超過了 %{max} 字的限制 @@ -292,7 +292,7 @@ zh-HK: time: formats: default: "%Y年%-m月%d日 %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: 請輸入你認證器產生的代碼,以確認設定 description_html: 當你啟用<strong>雙重認證</strong>後,你登入時將需要使你手機、或其他種類認證器產生的代碼。 disable: 停用 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index c29f2e231..965e007fd 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -248,7 +248,7 @@ zh-TW: import: 匯入 preferences: 偏好設定 settings: 設定 - two_factor_auth: 雙因子認證 + two_factor_authentication: 雙因子認證 statuses: open_in_web: 以網頁開啟 over_character_limit: 超過了 %{max} 字的限制 @@ -264,7 +264,7 @@ zh-TW: time: formats: default: "%Y年%-m月%d日 %H:%M" - two_factor_auth: + two_factor_authentication: code_hint: 請輸入您認證器產生的代碼,以進行認證 description_html: 當您啟用<strong>雙因子認證</strong>後,您登入時將需要使您手機、或其他種類認證器產生的代碼。 disable: 停用 diff --git a/config/navigation.rb b/config/navigation.rb index a3f752e47..bdc0a7b6c 100644 --- a/config/navigation.rb +++ b/config/navigation.rb @@ -8,7 +8,7 @@ SimpleNavigation::Configuration.run do |navigation| settings.item :profile, safe_join([fa_icon('user fw'), t('settings.edit_profile')]), settings_profile_url settings.item :preferences, safe_join([fa_icon('sliders fw'), t('settings.preferences')]), settings_preferences_url settings.item :password, safe_join([fa_icon('cog fw'), t('auth.change_password')]), edit_user_registration_url - settings.item :two_factor_auth, safe_join([fa_icon('mobile fw'), t('settings.two_factor_auth')]), settings_two_factor_auth_url, highlights_on: %r{/settings/two_factor_auth} + settings.item :two_factor_authentication, safe_join([fa_icon('mobile fw'), t('settings.two_factor_authentication')]), settings_two_factor_authentication_url, highlights_on: %r{/settings/two_factor_authentication} settings.item :import, safe_join([fa_icon('cloud-upload fw'), t('settings.import')]), settings_import_url settings.item :export, safe_join([fa_icon('cloud-download fw'), t('settings.export')]), settings_export_url settings.item :authorized_apps, safe_join([fa_icon('list fw'), t('settings.authorized_apps')]), oauth_authorized_applications_url diff --git a/config/routes.rb b/config/routes.rb index d9b36661e..abc77535a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,11 +58,10 @@ Rails.application.routes.draw do resources :mutes, only: :index, controller: :muted_accounts end - resource :two_factor_auth, only: [:show, :new, :create] do - member do - post :disable - post :recovery_codes - end + resource :two_factor_authentication, only: [:show, :create, :destroy] + namespace :two_factor_authentication do + resources :recovery_codes, only: [:create] + resource :confirmation, only: [:new, :create] end end |