devise_token_auth 0.1.43 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +42 -895
- data/Rakefile +11 -4
- data/app/controllers/devise_token_auth/application_controller.rb +19 -8
- data/app/controllers/devise_token_auth/concerns/resource_finder.rb +26 -12
- data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +106 -85
- data/app/controllers/devise_token_auth/confirmations_controller.rb +73 -17
- data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +95 -51
- data/app/controllers/devise_token_auth/passwords_controller.rb +65 -57
- data/app/controllers/devise_token_auth/registrations_controller.rb +61 -61
- data/app/controllers/devise_token_auth/sessions_controller.rb +22 -18
- data/app/controllers/devise_token_auth/token_validations_controller.rb +5 -3
- data/app/controllers/devise_token_auth/unlocks_controller.rb +20 -16
- data/app/models/devise_token_auth/concerns/active_record_support.rb +14 -0
- data/app/models/devise_token_auth/concerns/confirmable_support.rb +28 -0
- data/app/models/devise_token_auth/concerns/mongoid_support.rb +19 -0
- data/app/models/devise_token_auth/concerns/tokens_serialization.rb +31 -0
- data/app/models/devise_token_auth/concerns/user.rb +92 -100
- data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +8 -3
- data/app/validators/{email_validator.rb → devise_token_auth_email_validator.rb} +5 -3
- data/app/views/devise_token_auth/omniauth_external_window.html.erb +1 -1
- data/config/locales/da-DK.yml +11 -9
- data/config/locales/de.yml +2 -0
- data/config/locales/en.yml +10 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/he.yml +52 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/ja.yml +4 -2
- data/config/locales/ko.yml +51 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/pl.yml +6 -3
- data/config/locales/pt-BR.yml +2 -0
- data/config/locales/pt.yml +6 -3
- data/config/locales/ro.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/sq.yml +2 -0
- data/config/locales/sv.yml +52 -0
- data/config/locales/uk.yml +2 -0
- data/config/locales/vi.yml +2 -0
- data/config/locales/zh-CN.yml +2 -0
- data/config/locales/zh-HK.yml +2 -0
- data/config/locales/zh-TW.yml +2 -0
- data/lib/devise_token_auth/blacklist.rb +6 -0
- data/lib/devise_token_auth/controllers/helpers.rb +21 -13
- data/lib/devise_token_auth/controllers/url_helpers.rb +2 -0
- data/lib/devise_token_auth/engine.rb +26 -14
- data/lib/devise_token_auth/errors.rb +8 -0
- data/lib/devise_token_auth/rails/routes.rb +37 -30
- data/lib/devise_token_auth/token_factory.rb +126 -0
- data/lib/devise_token_auth/url.rb +11 -4
- data/lib/devise_token_auth/version.rb +3 -1
- data/lib/devise_token_auth.rb +11 -5
- data/lib/generators/devise_token_auth/USAGE +2 -2
- data/lib/generators/devise_token_auth/install_generator.rb +36 -105
- data/lib/generators/devise_token_auth/install_generator_helpers.rb +98 -0
- data/lib/generators/devise_token_auth/install_mongoid_generator.rb +46 -0
- data/lib/generators/devise_token_auth/install_views_generator.rb +7 -5
- data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +12 -0
- data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +8 -14
- data/lib/generators/devise_token_auth/templates/user.rb.erb +9 -0
- data/lib/generators/devise_token_auth/templates/user_mongoid.rb.erb +56 -0
- data/lib/tasks/devise_token_auth_tasks.rake +2 -0
- data/test/controllers/custom/custom_confirmations_controller_test.rb +5 -1
- data/test/controllers/custom/custom_omniauth_callbacks_controller_test.rb +4 -0
- data/test/controllers/custom/custom_passwords_controller_test.rb +6 -2
- data/test/controllers/custom/custom_registrations_controller_test.rb +17 -8
- data/test/controllers/custom/custom_sessions_controller_test.rb +7 -5
- data/test/controllers/custom/custom_token_validations_controller_test.rb +5 -3
- data/test/controllers/demo_group_controller_test.rb +4 -6
- data/test/controllers/demo_mang_controller_test.rb +3 -3
- data/test/controllers/demo_user_controller_test.rb +53 -25
- data/test/controllers/devise_token_auth/confirmations_controller_test.rb +159 -25
- data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +117 -47
- data/test/controllers/devise_token_auth/passwords_controller_test.rb +309 -126
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +65 -23
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +93 -61
- data/test/controllers/devise_token_auth/token_validations_controller_test.rb +18 -6
- data/test/controllers/devise_token_auth/unlocks_controller_test.rb +24 -5
- data/test/controllers/overrides/confirmations_controller_test.rb +6 -2
- data/test/controllers/overrides/omniauth_callbacks_controller_test.rb +5 -1
- data/test/controllers/overrides/passwords_controller_test.rb +27 -29
- data/test/controllers/overrides/registrations_controller_test.rb +33 -27
- data/test/controllers/overrides/sessions_controller_test.rb +6 -4
- data/test/controllers/overrides/token_validations_controller_test.rb +5 -3
- data/test/dummy/app/active_record/confirmable_user.rb +11 -0
- data/test/dummy/app/{models → active_record}/lockable_user.rb +2 -0
- data/test/dummy/app/{models → active_record}/mang.rb +2 -0
- data/test/dummy/app/{models → active_record}/only_email_user.rb +2 -0
- data/test/dummy/app/{models → active_record}/scoped_user.rb +4 -2
- data/test/dummy/app/{models → active_record}/unconfirmable_user.rb +3 -2
- data/test/dummy/app/active_record/unregisterable_user.rb +9 -0
- data/test/dummy/app/active_record/user.rb +6 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/auth_origin_controller.rb +2 -0
- data/test/dummy/app/controllers/custom/confirmations_controller.rb +2 -2
- data/test/dummy/app/controllers/custom/omniauth_callbacks_controller.rb +2 -0
- data/test/dummy/app/controllers/custom/passwords_controller.rb +3 -4
- data/test/dummy/app/controllers/custom/registrations_controller.rb +3 -3
- data/test/dummy/app/controllers/custom/sessions_controller.rb +3 -3
- data/test/dummy/app/controllers/custom/token_validations_controller.rb +3 -3
- data/test/dummy/app/controllers/demo_group_controller.rb +2 -0
- data/test/dummy/app/controllers/demo_mang_controller.rb +2 -0
- data/test/dummy/app/controllers/demo_user_controller.rb +2 -0
- data/test/dummy/app/controllers/overrides/confirmations_controller.rb +8 -6
- data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +5 -3
- data/test/dummy/app/controllers/overrides/passwords_controller.rb +10 -8
- data/test/dummy/app/controllers/overrides/registrations_controller.rb +5 -3
- data/test/dummy/app/controllers/overrides/sessions_controller.rb +12 -12
- data/test/dummy/app/controllers/overrides/token_validations_controller.rb +5 -5
- data/test/dummy/app/helpers/application_helper.rb +1029 -1036
- data/test/dummy/app/models/{user.rb → concerns/favorite_color.rb} +8 -7
- data/test/dummy/app/mongoid/confirmable_user.rb +52 -0
- data/test/dummy/app/mongoid/lockable_user.rb +38 -0
- data/test/dummy/app/mongoid/mang.rb +46 -0
- data/test/dummy/app/mongoid/only_email_user.rb +33 -0
- data/test/dummy/app/mongoid/scoped_user.rb +50 -0
- data/test/dummy/app/mongoid/unconfirmable_user.rb +44 -0
- data/test/dummy/app/mongoid/unregisterable_user.rb +47 -0
- data/test/dummy/app/mongoid/user.rb +49 -0
- data/test/dummy/app/views/layouts/application.html.erb +0 -2
- data/test/dummy/config/application.rb +26 -3
- data/test/dummy/config/boot.rb +8 -2
- data/test/dummy/config/environment.rb +3 -1
- data/test/dummy/config/environments/development.rb +5 -13
- data/test/dummy/config/environments/production.rb +2 -16
- data/test/dummy/config/environments/test.rb +3 -1
- data/test/dummy/config/initializers/backtrace_silencers.rb +2 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -1
- data/test/dummy/config/initializers/devise.rb +287 -0
- data/test/dummy/config/initializers/devise_token_auth.rb +37 -4
- data/test/dummy/config/initializers/figaro.rb +3 -1
- data/test/dummy/config/initializers/filter_parameter_logging.rb +2 -0
- data/test/dummy/config/initializers/inflections.rb +2 -0
- data/test/dummy/config/initializers/mime_types.rb +2 -0
- data/test/dummy/config/initializers/omniauth.rb +5 -2
- data/test/dummy/config/initializers/session_store.rb +2 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -0
- data/test/dummy/config/routes.rb +14 -29
- data/test/dummy/config/spring.rb +2 -0
- data/test/dummy/config.ru +5 -3
- data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +9 -14
- data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +8 -13
- data/test/dummy/db/migrate/20140829044006_add_operating_thetan_to_user.rb +2 -0
- data/test/dummy/db/migrate/20140916224624_add_favorite_color_to_mangs.rb +2 -0
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +6 -11
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +8 -13
- data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +8 -13
- data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +8 -13
- data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +8 -13
- data/test/dummy/{tmp/generators/db/migrate/20171014052631_devise_token_auth_create_users.rb → db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb} +8 -14
- data/test/dummy/db/schema.rb +11 -71
- data/test/dummy/lib/migration_database_helper.rb +15 -1
- data/test/dummy/tmp/generators/app/controllers/application_controller.rb +6 -0
- data/test/dummy/tmp/generators/app/models/azpire/v1/human_resource/user.rb +56 -0
- data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +12 -0
- data/test/factories/users.rb +41 -0
- data/test/lib/devise_token_auth/blacklist_test.rb +19 -0
- data/test/lib/devise_token_auth/rails/custom_routes_test.rb +29 -0
- data/test/lib/devise_token_auth/rails/routes_test.rb +87 -0
- data/test/lib/devise_token_auth/token_factory_test.rb +191 -0
- data/test/lib/devise_token_auth/url_test.rb +9 -7
- data/test/lib/generators/devise_token_auth/install_generator_test.rb +67 -37
- data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +222 -0
- data/test/lib/generators/devise_token_auth/install_views_generator_test.rb +3 -1
- data/test/models/concerns/mongoid_support_test.rb +31 -0
- data/test/models/concerns/tokens_serialization_test.rb +104 -0
- data/test/models/confirmable_user_test.rb +35 -0
- data/test/models/only_email_user_test.rb +2 -8
- data/test/models/user_test.rb +18 -79
- data/test/support/controllers/routes.rb +43 -0
- data/test/test_helper.rb +83 -26
- metadata +153 -44
- data/config/initializers/devise.rb +0 -196
- data/lib/generators/devise_token_auth/templates/user.rb +0 -7
- data/test/dummy/app/models/evil_user.rb +0 -3
- data/test/dummy/app/models/nice_user.rb +0 -7
- data/test/dummy/app/models/unregisterable_user.rb +0 -7
- data/test/dummy/config/initializers/assets.rb +0 -8
- data/test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb +0 -64
- data/test/dummy/db/migrate/20150409095712_devise_token_auth_create_nice_users.rb +0 -61
- data/test/dummy/tmp/generators/app/models/user.rb +0 -11
- data/test/integration/navigation_test.rb +0 -10
@@ -0,0 +1,51 @@
|
|
1
|
+
ko:
|
2
|
+
devise_token_auth:
|
3
|
+
sessions:
|
4
|
+
not_confirmed: "'%{email}'로 주소 인증 메일을 발송했습니다. 계정을 활성화하기 위해서는 반드시 메일의 안내를 따라야 합니다."
|
5
|
+
bad_credentials: "계정 정보가 맞지 않습니다. 다시 시도해 주세요."
|
6
|
+
not_supported: "POST /sign_in to sign in을 사용해주세요. GET은 지원하지 않습니다."
|
7
|
+
user_not_found: "유저를 찾을 수 없습니다."
|
8
|
+
invalid: "계정 정보가 맞지 않습니다."
|
9
|
+
registrations:
|
10
|
+
missing_confirm_success_url: "'confirm_success_url' 파라미터가 없습니다."
|
11
|
+
redirect_url_not_allowed: "'%{redirect_url}' 주소로 리다이렉트는 허용하지 않습니다."
|
12
|
+
email_already_exists: "'%{email}'을 사용하는 계정이 이미 있습니다."
|
13
|
+
account_with_uid_destroyed: " UID가 '%{uid}'인 계정을 삭제했습니다."
|
14
|
+
account_to_destroy_not_found: "삭제할 계정을 찾을 수 없습니다."
|
15
|
+
user_not_found: "유저를 찾을 수 없습니다."
|
16
|
+
omniauth:
|
17
|
+
not_allowed_redirect_url: "'%{redirect_url}' 주소로 리다이렉트는 허용하지 않습니다."
|
18
|
+
passwords:
|
19
|
+
missing_email: "이메일 주소를 입력해야 합니다."
|
20
|
+
missing_redirect_url: "redirect URL이 없습니다."
|
21
|
+
not_allowed_redirect_url: "'%{redirect_url}' 주소로 리다이렉트는 허용하지 않습니다."
|
22
|
+
sended: "'%{email}'로 비밀번호를 재설정하기 위한 안내 메일을 발송했습니다."
|
23
|
+
user_not_found: "'%{email}'을 사용하는 유저를 찾을 수 없습니다."
|
24
|
+
password_not_required: "이 계정은 비밀번호가 필요하지 않습니다. '%{provider}'으로 로그인을 진행해 주세요."
|
25
|
+
missing_passwords: "비밀번호와 비밀번호 확인 필드를 반드시 입력해야 합니다."
|
26
|
+
successfully_updated: "비밀번호를 성공적으로 업데이트 했습니다."
|
27
|
+
unlocks:
|
28
|
+
missing_email: "이메일 주소를 반드시 입력해야 합니다."
|
29
|
+
sended: "'%{email}'로 계정 잠금 해제를 위한 안내 메일을 발송했습니다."
|
30
|
+
user_not_found: "'%{email}'을 사용하는 유저를 찾을 수 없습니다."
|
31
|
+
errors:
|
32
|
+
messages:
|
33
|
+
validate_sign_up_params: "요청 값에 알맞은 로그인 데이터를 입력하세요."
|
34
|
+
validate_account_update_params: "요청 값에 알맞은 업데이트 데이터를 입력하세요."
|
35
|
+
not_email: "이메일이 아닙니다."
|
36
|
+
devise:
|
37
|
+
mailer:
|
38
|
+
confirmation_instructions:
|
39
|
+
confirm_link_msg: "아래의 링크를 이용해 계정 인증을 할 수 있습니다."
|
40
|
+
confirm_account_link: "본인 계정 인증"
|
41
|
+
reset_password_instructions:
|
42
|
+
request_reset_link_msg: "누군가 당신의 비밀번호를 변경하는 링크를 요청했으며, 다음의 링크에서 비밀번호 변경이 가능합니다."
|
43
|
+
password_change_link: "비밀번호 변경"
|
44
|
+
ignore_mail_msg: "비밀번호 변경을 요청하지 않으셨다면 이 메일을 무시하십시오."
|
45
|
+
no_changes_msg: "위 링크에 접속하여 새로운 비밀번호를 생성하기 전까지 귀하의 비밀번호는 변경되지 않습니다."
|
46
|
+
unlock_instructions:
|
47
|
+
account_lock_msg: "로그인 실패 횟수 초과로 귀하의 계정이 잠금 처리되었습니다."
|
48
|
+
unlock_link_msg: "계정 잠금을 해제하려면 아래 링크를 클릭하세요."
|
49
|
+
unlock_link: "계정 잠금 해제"
|
50
|
+
hello: "안녕하세요"
|
51
|
+
welcome: "환영합니다"
|
data/config/locales/nl.yml
CHANGED
@@ -14,6 +14,8 @@ nl:
|
|
14
14
|
account_with_uid_destroyed: "Account met id '%{uid}' is verwijderd."
|
15
15
|
account_to_destroy_not_found: "Te verwijderen account niet gevonden."
|
16
16
|
user_not_found: "Gebruiker niet gevonden."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Redirect naar '%{redirect_url}' niet toegestaan."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Je moet een e-mailadres opgeven."
|
19
21
|
missing_redirect_url: "Redirect URL ontbreekt."
|
data/config/locales/pl.yml
CHANGED
@@ -14,6 +14,8 @@ pl:
|
|
14
14
|
account_with_uid_destroyed: "Konto z uid '%{uid}' zostało usunięte."
|
15
15
|
account_to_destroy_not_found: "Nie odnaleziono konta do usunięcia."
|
16
16
|
user_not_found: "Użytkownik nie został odnaleziony."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Przekierowanie na adres '%{redirect_url}' nie jest dozwolone."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Musisz wprowadzić adres e-mail."
|
19
21
|
missing_redirect_url: "Brak adresu zwrotnego."
|
@@ -24,9 +26,10 @@ pl:
|
|
24
26
|
missing_passwords: "Musisz wypełnić wszystkie pola z etykietą 'Hasło' oraz 'Potwierdzenie hasła'."
|
25
27
|
successfully_updated: "Twoje hasło zostało zaktualizowane."
|
26
28
|
errors:
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
messages:
|
30
|
+
validate_sign_up_params: "Proszę dostarczyć odpowiednie dane logowania w ciele zapytania."
|
31
|
+
validate_account_update_params: "Proszę dostarczyć odpowiednie dane aktualizacji konta w ciele zapytania."
|
32
|
+
not_email: "nie jest prawidłowym adresem e-mail"
|
30
33
|
devise:
|
31
34
|
mailer:
|
32
35
|
confirmation_instructions:
|
data/config/locales/pt-BR.yml
CHANGED
@@ -14,6 +14,8 @@ pt-BR:
|
|
14
14
|
account_with_uid_destroyed: "A conta com uid '%{uid}' foi excluída."
|
15
15
|
account_to_destroy_not_found: "Não foi possível encontrar a conta para exclusão."
|
16
16
|
user_not_found: "Usuário não encontrado."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Redirecionamento para '%{redirect_url}' não permitido."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Informe o endereço de e-mail."
|
19
21
|
missing_redirect_url: "URL para redirecionamento não informada."
|
data/config/locales/pt.yml
CHANGED
@@ -14,6 +14,8 @@ pt:
|
|
14
14
|
account_with_uid_destroyed: "A conta com uid '%{uid}' foi excluída."
|
15
15
|
account_to_destroy_not_found: "Não foi possível encontrar a conta para exclusão."
|
16
16
|
user_not_found: "Utilizador não encontrado."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Redirecionamento para '%{redirect_url}' não permitido."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Informe o endereço de e-mail."
|
19
21
|
missing_redirect_url: "URL para redirecionamento não informada."
|
@@ -24,9 +26,10 @@ pt:
|
|
24
26
|
missing_passwords: "Preencha a senha e a confirmação de senha."
|
25
27
|
successfully_updated: "Senha atualizada com sucesso."
|
26
28
|
errors:
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
messages:
|
30
|
+
validate_sign_up_params: "Os dados submetidos na requisição de registo são inválidos."
|
31
|
+
validate_account_update_params: "Os dados submetidos para atualização de conta são inválidos."
|
32
|
+
not_email: "não é um e-mail"
|
30
33
|
devise:
|
31
34
|
mailer:
|
32
35
|
confirmation_instructions:
|
data/config/locales/ro.yml
CHANGED
@@ -14,6 +14,8 @@ ro:
|
|
14
14
|
account_with_uid_destroyed: "Contul cu UID '%{uid}' a fost șters."
|
15
15
|
account_to_destroy_not_found: "Nu se poate localiza contul pentru ștergere."
|
16
16
|
user_not_found: "Utilizatorul nu a fost găsit."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Redirecționarea către '%{redirect_url}' nu este permisă."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Trebuie să introduci o adresă de e-mail."
|
19
21
|
missing_redirect_url: "URL-ul pentru redirecționare lipsește."
|
data/config/locales/ru.yml
CHANGED
@@ -14,6 +14,8 @@ ru:
|
|
14
14
|
account_with_uid_destroyed: "Учетная запись с uid '%{uid}' удалена."
|
15
15
|
account_to_destroy_not_found: "Не удается найти учетную запись для удаления."
|
16
16
|
user_not_found: "Пользователь не найден."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Переадресация на '%{redirect_url}' не разрешена."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Вы должны указать адрес электронной почты."
|
19
21
|
missing_redirect_url: "Отсутствует адрес переадресации."
|
data/config/locales/sq.yml
CHANGED
@@ -14,6 +14,8 @@ sq:
|
|
14
14
|
account_with_uid_destroyed: "Llogaria me UID-në '%{uid}' është fshirë."
|
15
15
|
account_to_destroy_not_found: "Nuk u gjet llogaria për fshirje."
|
16
16
|
user_not_found: "Përdoruesi nuk u gjet."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Nuk lejohet shkuarja tek URL-ja '%{redirect_url}'."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Ju duhet të jepni një email adresë."
|
19
21
|
missing_redirect_url: "Mungon URL-ja për ridërgim."
|
@@ -0,0 +1,52 @@
|
|
1
|
+
sv:
|
2
|
+
devise_token_auth:
|
3
|
+
sessions:
|
4
|
+
not_confirmed: "Ett bekräftelse-email har skickats till '%{email}'. Följ instruktionerna i emailet så kan ditt konto aktiveras"
|
5
|
+
bad_credentials: "Ogiltig login-information. Vänligen försök igen."
|
6
|
+
not_supported: "Använd POST /sign_in för att logga in. GET stöds inte."
|
7
|
+
user_not_found: "Användaren hittades inte eller var inte inloggad."
|
8
|
+
token_validations:
|
9
|
+
invalid: "Ogiltig token-information"
|
10
|
+
registrations:
|
11
|
+
missing_confirm_success_url: "Saknar 'confirm_success_url'-parameter."
|
12
|
+
redirect_url_not_allowed: "Omdirigering till '%{redirect_url}' ej tillåten."
|
13
|
+
email_already_exists: "Det finns redan ett konto för '%{email}'"
|
14
|
+
account_with_uid_destroyed: "Kontot med UID '%{uid}' har tagits bort."
|
15
|
+
account_to_destroy_not_found: "Kunde inte hitta kontot för borttagning."
|
16
|
+
user_not_found: "Användaren hittades ej."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Omdirigering till '%{redirect_url}' ej tillåten."
|
19
|
+
passwords:
|
20
|
+
missing_email: "Du måste ange en emailadress."
|
21
|
+
missing_redirect_url: "Saknar en omdirigerings-URL."
|
22
|
+
not_allowed_redirect_url: "Omdirigering till '%{redirect_url}' ej tillåten."
|
23
|
+
sended: "Ett email har skickats till '%{email}' med instruktioner för hur du skapar ett nytt lösenord."
|
24
|
+
user_not_found: "Kunde inte hitta användaren med email '%{email}'."
|
25
|
+
password_not_required: "Det har kontot kräver inget lösenord. Logga in via ditt '%{provider}'-konto istället."
|
26
|
+
missing_passwords: "Du måste fylla i fälten 'Lösenord' och 'Upprepa lösenord'."
|
27
|
+
successfully_updated: "Ditt lösenord har ändrats."
|
28
|
+
unlocks:
|
29
|
+
missing_email: "Du måste ange en emailadress."
|
30
|
+
sended: "Ett email har skickats till '%{email}' med instruktioner för hur du låser upp ditt konto."
|
31
|
+
user_not_found: "Kunde inte hitta användaren med emailadressen '%{email}'."
|
32
|
+
errors:
|
33
|
+
messages:
|
34
|
+
validate_sign_up_params: "Vänligen skicka giltig data för att skapa konto i request-bodyn."
|
35
|
+
validate_account_update_params: "Vänligen skicka giltig data för att uppdatera konto i request-bodyn."
|
36
|
+
not_email: "är inte en emailadress"
|
37
|
+
devise:
|
38
|
+
mailer:
|
39
|
+
confirmation_instructions:
|
40
|
+
confirm_link_msg: "Du kan bekräfta ditt kontos emailadress genom att besöka länken nedan:"
|
41
|
+
confirm_account_link: "Bekräfta mitt konto"
|
42
|
+
reset_password_instructions:
|
43
|
+
request_reset_link_msg: "Någon har begärt en länk för att ändra ditt lösenord. Du kan göra detta via länken nedan."
|
44
|
+
password_change_link: "Byt mitt lösenord"
|
45
|
+
ignore_mail_msg: "Om du inte begärt detta, vänligen bortse från detta mail."
|
46
|
+
no_changes_msg: "Ditt lösenord kommer inte att ändras förrän du använder länken ovan och skapar ett nytt."
|
47
|
+
unlock_instructions:
|
48
|
+
account_lock_msg: "Ditt konto har låsts efter för många misslyckade loginförsök."
|
49
|
+
unlock_link_msg: "Klicka på länken nedan för att låsa upp ditt konto:"
|
50
|
+
unlock_link: "Lås upp mitt konto"
|
51
|
+
hello: "hej"
|
52
|
+
welcome: "välkommen"
|
data/config/locales/uk.yml
CHANGED
@@ -14,6 +14,8 @@ uk:
|
|
14
14
|
account_with_uid_destroyed: "Акаунт з UID '%{uid}' було видалено."
|
15
15
|
account_to_destroy_not_found: "Неможливо знайти акаунт для видалення."
|
16
16
|
user_not_found: "Користувача не знайдено"
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Перенаправлення до '%{redirect_url}' не дозволено."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Ви маєте ввести email адресу."
|
19
21
|
missing_redirect_url: "Немає URL для перенаправлення."
|
data/config/locales/vi.yml
CHANGED
@@ -14,6 +14,8 @@ vi:
|
|
14
14
|
account_with_uid_destroyed: "Tài khoản với UID '%{uid}' vừa bị phá hủy."
|
15
15
|
account_to_destroy_not_found: "Không thể xác định tài khoản cho việc phá hủy."
|
16
16
|
user_not_found: "Người dùng không tìm thấy."
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "Chuyển hướng tới '%{redirect_url}' không được phép."
|
17
19
|
passwords:
|
18
20
|
missing_email: "Bạn cần cung cấp địa chỉ email."
|
19
21
|
missing_redirect_url: "Thiếu đường đẫn URL."
|
data/config/locales/zh-CN.yml
CHANGED
@@ -14,6 +14,8 @@ zh-CN:
|
|
14
14
|
account_with_uid_destroyed: "账号 '%{uid}' 已被移除。"
|
15
15
|
account_to_destroy_not_found: "无法找到目标帐号。"
|
16
16
|
user_not_found: "找不到帐号。"
|
17
|
+
omniauth:
|
18
|
+
not_allowed_redirect_url: "不支持转向到 '%{redirect_url}'"
|
17
19
|
passwords:
|
18
20
|
missing_email: "必需提供邮箱。"
|
19
21
|
missing_redirect_url: "欠缺 redirect URL."
|
data/config/locales/zh-HK.yml
CHANGED
@@ -16,6 +16,8 @@ zh-TW:
|
|
16
16
|
account_with_uid_destroyed: "帳號 '%{uid}' 已被移除。"
|
17
17
|
account_to_destroy_not_found: "無法找到目標帳號。"
|
18
18
|
user_not_found: "找不到帳號。"
|
19
|
+
omniauth:
|
20
|
+
not_allowed_redirect_url: "不支援轉向到 '%{redirect_url}'"
|
19
21
|
passwords:
|
20
22
|
missing_email: "必需提供電郵。"
|
21
23
|
missing_redirect_url: "欠缺 redirect URL."
|
data/config/locales/zh-TW.yml
CHANGED
@@ -16,6 +16,8 @@ zh-TW:
|
|
16
16
|
account_with_uid_destroyed: "帳號 '%{uid}' 已被移除。"
|
17
17
|
account_to_destroy_not_found: "無法找到目標帳號。"
|
18
18
|
user_not_found: "找不到帳號。"
|
19
|
+
omniauth:
|
20
|
+
not_allowed_redirect_url: "不支援轉向到 '%{redirect_url}'"
|
19
21
|
passwords:
|
20
22
|
missing_email: "必需提供電郵。"
|
21
23
|
missing_redirect_url: "欠缺 redirect URL."
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# don't serialize tokens
|
2
|
+
if defined? Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION
|
3
|
+
Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION << :tokens
|
4
|
+
else
|
5
|
+
Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION << :tokens
|
6
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module DeviseTokenAuth
|
2
4
|
module Controllers
|
3
5
|
module Helpers
|
@@ -26,18 +28,12 @@ module DeviseTokenAuth
|
|
26
28
|
# before_action ->{ authenticate_blogger! :admin } # Redirects to the admin login page
|
27
29
|
# current_blogger :user # Preferably returns a User if one is signed in
|
28
30
|
#
|
29
|
-
def devise_token_auth_group(group_name, opts={})
|
30
|
-
mappings = "[#{
|
31
|
+
def devise_token_auth_group(group_name, opts = {})
|
32
|
+
mappings = "[#{opts[:contains].map { |m| ":#{m}" }.join(',')}]"
|
31
33
|
|
32
34
|
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
33
35
|
def authenticate_#{group_name}!(favourite=nil, opts={})
|
34
36
|
unless #{group_name}_signed_in?
|
35
|
-
mappings = #{mappings}
|
36
|
-
mappings.unshift mappings.delete(favourite.to_sym) if favourite
|
37
|
-
mappings.each do |mapping|
|
38
|
-
set_user_by_token(mapping)
|
39
|
-
end
|
40
|
-
|
41
37
|
unless current_#{group_name}
|
42
38
|
render_authenticate_error
|
43
39
|
end
|
@@ -45,12 +41,14 @@ module DeviseTokenAuth
|
|
45
41
|
end
|
46
42
|
|
47
43
|
def #{group_name}_signed_in?
|
48
|
-
#{
|
49
|
-
set_user_by_token(mapping)
|
50
|
-
end
|
44
|
+
!!current_#{group_name}
|
51
45
|
end
|
52
46
|
|
53
47
|
def current_#{group_name}(favourite=nil)
|
48
|
+
@current_#{group_name} ||= set_group_user_by_token(favourite)
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_group_user_by_token(favourite)
|
54
52
|
mappings = #{mappings}
|
55
53
|
mappings.unshift mappings.delete(favourite.to_sym) if favourite
|
56
54
|
mappings.each do |mapping|
|
@@ -73,7 +71,12 @@ module DeviseTokenAuth
|
|
73
71
|
end
|
74
72
|
|
75
73
|
if respond_to?(:helper_method)
|
76
|
-
helper_method
|
74
|
+
helper_method(
|
75
|
+
"current_#{group_name}",
|
76
|
+
"current_#{group_name.to_s.pluralize}",
|
77
|
+
"#{group_name}_signed_in?",
|
78
|
+
"render_authenticate_error"
|
79
|
+
)
|
77
80
|
end
|
78
81
|
METHODS
|
79
82
|
end
|
@@ -140,7 +143,12 @@ module DeviseTokenAuth
|
|
140
143
|
|
141
144
|
ActiveSupport.on_load(:action_controller) do
|
142
145
|
if respond_to?(:helper_method)
|
143
|
-
helper_method
|
146
|
+
helper_method(
|
147
|
+
"current_#{mapping}",
|
148
|
+
"#{mapping}_signed_in?",
|
149
|
+
"#{mapping}_session",
|
150
|
+
'render_authenticate_error'
|
151
|
+
)
|
144
152
|
end
|
145
153
|
end
|
146
154
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'devise_token_auth/rails/routes'
|
2
4
|
|
3
5
|
module DeviseTokenAuth
|
4
6
|
class Engine < ::Rails::Engine
|
5
7
|
isolate_namespace DeviseTokenAuth
|
6
8
|
|
7
|
-
initializer
|
9
|
+
initializer 'devise_token_auth.url_helpers' do
|
8
10
|
Devise.helpers << DeviseTokenAuth::Controllers::Helpers
|
9
11
|
end
|
10
12
|
end
|
@@ -12,6 +14,7 @@ module DeviseTokenAuth
|
|
12
14
|
mattr_accessor :change_headers_on_each_request,
|
13
15
|
:max_number_of_devices,
|
14
16
|
:token_lifespan,
|
17
|
+
:token_cost,
|
15
18
|
:batch_request_buffer_throttle,
|
16
19
|
:omniauth_prefix,
|
17
20
|
:default_confirm_success_url,
|
@@ -22,11 +25,17 @@ module DeviseTokenAuth
|
|
22
25
|
:remove_tokens_after_password_reset,
|
23
26
|
:default_callbacks,
|
24
27
|
:headers_names,
|
25
|
-
:
|
28
|
+
:cookie_enabled,
|
29
|
+
:cookie_name,
|
30
|
+
:cookie_attributes,
|
31
|
+
:bypass_sign_in,
|
32
|
+
:send_confirmation_email,
|
33
|
+
:require_client_password_reset_token
|
26
34
|
|
27
35
|
self.change_headers_on_each_request = true
|
28
36
|
self.max_number_of_devices = 10
|
29
37
|
self.token_lifespan = 2.weeks
|
38
|
+
self.token_cost = 10
|
30
39
|
self.batch_request_buffer_throttle = 5.seconds
|
31
40
|
self.omniauth_prefix = '/omniauth'
|
32
41
|
self.default_confirm_success_url = nil
|
@@ -36,35 +45,38 @@ module DeviseTokenAuth
|
|
36
45
|
self.enable_standard_devise_support = false
|
37
46
|
self.remove_tokens_after_password_reset = false
|
38
47
|
self.default_callbacks = true
|
39
|
-
self.headers_names = {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
self.headers_names = { 'access-token': 'access-token',
|
49
|
+
'client': 'client',
|
50
|
+
'expiry': 'expiry',
|
51
|
+
'uid': 'uid',
|
52
|
+
'token-type': 'token-type' }
|
53
|
+
self.cookie_enabled = false
|
54
|
+
self.cookie_name = 'auth_cookie'
|
55
|
+
self.cookie_attributes = {}
|
44
56
|
self.bypass_sign_in = true
|
57
|
+
self.send_confirmation_email = false
|
58
|
+
self.require_client_password_reset_token = false
|
45
59
|
|
46
60
|
def self.setup(&block)
|
47
61
|
yield self
|
48
62
|
|
49
63
|
Rails.application.config.after_initialize do
|
50
64
|
if defined?(::OmniAuth)
|
51
|
-
::OmniAuth::config.path_prefix = Devise.omniauth_path_prefix =
|
52
|
-
|
65
|
+
::OmniAuth::config.path_prefix = Devise.omniauth_path_prefix = omniauth_prefix
|
53
66
|
|
54
67
|
# Omniauth currently does not pass along omniauth.params upon failure redirect
|
55
68
|
# see also: https://github.com/intridea/omniauth/issues/626
|
56
69
|
OmniAuth::FailureEndpoint.class_eval do
|
57
70
|
def redirect_to_failure
|
58
71
|
message_key = env['omniauth.error.type']
|
59
|
-
origin_query_param = env['omniauth.origin'] ? "&origin=#{CGI.escape(env['omniauth.origin'])}" :
|
60
|
-
strategy_name_query_param = env['omniauth.error.strategy'] ? "&strategy=#{env['omniauth.error.strategy'].name}" :
|
61
|
-
extra_params = env['omniauth.params'] ? "&#{env['omniauth.params'].to_query}" :
|
72
|
+
origin_query_param = env['omniauth.origin'] ? "&origin=#{CGI.escape(env['omniauth.origin'])}" : ''
|
73
|
+
strategy_name_query_param = env['omniauth.error.strategy'] ? "&strategy=#{env['omniauth.error.strategy'].name}" : ''
|
74
|
+
extra_params = env['omniauth.params'] ? "&#{env['omniauth.params'].to_query}" : ''
|
62
75
|
new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}#{origin_query_param}#{strategy_name_query_param}#{extra_params}"
|
63
|
-
Rack::Response.new([
|
76
|
+
Rack::Response.new(['302 Moved'], 302, 'Location' => new_path).finish
|
64
77
|
end
|
65
78
|
end
|
66
79
|
|
67
|
-
|
68
80
|
# Omniauth currently removes omniauth.params during mocked requests
|
69
81
|
# see also: https://github.com/intridea/omniauth/pull/812
|
70
82
|
OmniAuth::Strategy.class_eval do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ActionDispatch::Routing
|
2
4
|
class Mapper
|
3
5
|
def mount_devise_token_auth_for(resource, opts)
|
@@ -6,31 +8,36 @@ module ActionDispatch::Routing
|
|
6
8
|
opts[:skip] ||= []
|
7
9
|
|
8
10
|
# check for ctrl overrides, fall back to defaults
|
9
|
-
sessions_ctrl = opts[:controllers]
|
10
|
-
registrations_ctrl = opts[:controllers]
|
11
|
-
passwords_ctrl = opts[:controllers]
|
12
|
-
confirmations_ctrl = opts[:controllers]
|
13
|
-
token_validations_ctrl = opts[:controllers]
|
14
|
-
omniauth_ctrl = opts[:controllers]
|
15
|
-
unlocks_ctrl = opts[:controllers]
|
11
|
+
sessions_ctrl = opts[:controllers].delete(:sessions) || 'devise_token_auth/sessions'
|
12
|
+
registrations_ctrl = opts[:controllers].delete(:registrations) || 'devise_token_auth/registrations'
|
13
|
+
passwords_ctrl = opts[:controllers].delete(:passwords) || 'devise_token_auth/passwords'
|
14
|
+
confirmations_ctrl = opts[:controllers].delete(:confirmations) || 'devise_token_auth/confirmations'
|
15
|
+
token_validations_ctrl = opts[:controllers].delete(:token_validations) || 'devise_token_auth/token_validations'
|
16
|
+
omniauth_ctrl = opts[:controllers].delete(:omniauth_callbacks) || 'devise_token_auth/omniauth_callbacks'
|
17
|
+
unlocks_ctrl = opts[:controllers].delete(:unlocks) || 'devise_token_auth/unlocks'
|
18
|
+
|
19
|
+
# check for resource override
|
20
|
+
route = opts[:as] || resource.pluralize.underscore.gsub('/', '_')
|
16
21
|
|
17
22
|
# define devise controller mappings
|
18
|
-
controllers =
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
controllers = opts[:controllers].merge(
|
24
|
+
sessions: sessions_ctrl,
|
25
|
+
registrations: registrations_ctrl,
|
26
|
+
passwords: passwords_ctrl,
|
27
|
+
confirmations: confirmations_ctrl
|
28
|
+
)
|
22
29
|
|
23
30
|
controllers[:unlocks] = unlocks_ctrl if unlocks_ctrl
|
24
31
|
|
25
32
|
# remove any unwanted devise modules
|
26
|
-
opts[:skip].each{|item| controllers.delete(item)}
|
33
|
+
opts[:skip].each{ |item| controllers.delete(item) }
|
27
34
|
|
28
|
-
devise_for
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
devise_for route.to_sym,
|
36
|
+
class_name: resource,
|
37
|
+
module: :devise,
|
38
|
+
path: opts[:at].to_s,
|
39
|
+
controllers: controllers,
|
40
|
+
skip: opts[:skip] + [:omniauth_callbacks]
|
34
41
|
|
35
42
|
unnest_namespace do
|
36
43
|
# get full url path as if it were namespaced
|
@@ -41,8 +48,8 @@ module ActionDispatch::Routing
|
|
41
48
|
|
42
49
|
# clear scope so controller routes aren't namespaced
|
43
50
|
@scope = ActionDispatch::Routing::Mapper::Scope.new(
|
44
|
-
path:
|
45
|
-
shallow_path:
|
51
|
+
path: '',
|
52
|
+
shallow_path: '',
|
46
53
|
constraints: {},
|
47
54
|
defaults: {},
|
48
55
|
options: {},
|
@@ -54,29 +61,29 @@ module ActionDispatch::Routing
|
|
54
61
|
|
55
62
|
devise_scope mapping_name.to_sym do
|
56
63
|
# path to verify token validity
|
57
|
-
get "#{full_path}/validate_token", controller:
|
64
|
+
get "#{full_path}/validate_token", controller: token_validations_ctrl.to_s, action: 'validate_token' if !opts[:skip].include?(:token_validations)
|
58
65
|
|
59
66
|
# omniauth routes. only define if omniauth is installed and not skipped.
|
60
67
|
if defined?(::OmniAuth) && !opts[:skip].include?(:omniauth_callbacks)
|
61
|
-
match "#{full_path}/failure", controller: omniauth_ctrl, action:
|
62
|
-
match "#{full_path}/:provider/callback", controller: omniauth_ctrl, action:
|
68
|
+
match "#{full_path}/failure", controller: omniauth_ctrl, action: 'omniauth_failure', via: [:get]
|
69
|
+
match "#{full_path}/:provider/callback", controller: omniauth_ctrl, action: 'omniauth_success', via: [:get]
|
63
70
|
|
64
|
-
match "#{DeviseTokenAuth.omniauth_prefix}/:provider/callback", controller: omniauth_ctrl, action:
|
65
|
-
match "#{DeviseTokenAuth.omniauth_prefix}/failure", controller: omniauth_ctrl, action:
|
71
|
+
match "#{DeviseTokenAuth.omniauth_prefix}/:provider/callback", controller: omniauth_ctrl, action: 'redirect_callbacks', via: [:get, :post]
|
72
|
+
match "#{DeviseTokenAuth.omniauth_prefix}/failure", controller: omniauth_ctrl, action: 'omniauth_failure', via: [:get, :post]
|
66
73
|
|
67
74
|
# preserve the resource class thru oauth authentication by setting name of
|
68
75
|
# resource as "resource_class" param
|
69
|
-
match "#{full_path}/:provider", to: redirect{|params, request|
|
76
|
+
match "#{full_path}/:provider", to: redirect{ |params, request|
|
70
77
|
# get the current querystring
|
71
|
-
qs = CGI::parse(request.env[
|
78
|
+
qs = CGI::parse(request.env['QUERY_STRING'])
|
72
79
|
|
73
80
|
# append name of current resource
|
74
|
-
qs[
|
75
|
-
qs[
|
81
|
+
qs['resource_class'] = [resource]
|
82
|
+
qs['namespace_name'] = [namespace_name] if namespace_name
|
76
83
|
|
77
84
|
set_omniauth_path_prefix!(DeviseTokenAuth.omniauth_prefix)
|
78
85
|
|
79
|
-
redirect_params = {}.tap {|hash| qs.each{|k, v| hash[k] = v.first}}
|
86
|
+
redirect_params = {}.tap { |hash| qs.each{ |k, v| hash[k] = v.first } }
|
80
87
|
|
81
88
|
if DeviseTokenAuth.redirect_whitelist
|
82
89
|
redirect_url = request.params['auth_origin_url']
|