devise_token_auth 0.1.37.beta4 → 0.1.37

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise_token_auth might be problematic. Click here for more details.

Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/app/controllers/devise_token_auth/application_controller.rb +4 -0
  4. data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +5 -5
  5. data/app/controllers/devise_token_auth/passwords_controller.rb +3 -3
  6. data/app/controllers/devise_token_auth/registrations_controller.rb +9 -8
  7. data/app/controllers/devise_token_auth/sessions_controller.rb +3 -3
  8. data/app/controllers/devise_token_auth/token_validations_controller.rb +2 -2
  9. data/app/models/devise_token_auth/concerns/user.rb +17 -3
  10. data/app/validators/email_validator.rb +6 -6
  11. data/config/locales/de.yml +12 -12
  12. data/config/locales/en.yml +20 -20
  13. data/config/locales/es.yml +24 -24
  14. data/config/locales/fr.yml +17 -17
  15. data/config/locales/pl.yml +15 -15
  16. data/config/locales/pt-BR.yml +9 -12
  17. data/config/locales/pt.yml +7 -7
  18. data/config/locales/ru.yml +18 -18
  19. data/config/locales/zh-HK.yml +49 -0
  20. data/config/locales/zh-TW.yml +49 -0
  21. data/lib/devise_token_auth/controllers/helpers.rb +11 -7
  22. data/lib/devise_token_auth/engine.rb +3 -1
  23. data/lib/devise_token_auth/rails/routes.rb +7 -1
  24. data/lib/devise_token_auth/version.rb +1 -1
  25. data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +2 -2
  26. data/test/controllers/demo_user_controller_test.rb +42 -0
  27. data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +0 -13
  28. data/test/controllers/devise_token_auth/token_validations_controller_test.rb +25 -0
  29. data/test/dummy/app/controllers/application_controller.rb +6 -5
  30. data/test/dummy/{tmp/generators/app/models/user.rb → app/models/scoped_user.rb} +1 -5
  31. data/test/dummy/config/routes.rb +13 -0
  32. data/test/dummy/{tmp/generators/db/migrate/20151027080542_devise_token_auth_create_users.rb → db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb} +15 -9
  33. data/test/dummy/db/schema.rb +30 -1
  34. data/test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  35. data/test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  36. metadata +27 -17
  37. data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +0 -28
@@ -1,27 +1,27 @@
1
1
  pl:
2
2
  devise_token_auth:
3
3
  sessions:
4
- not_confirmed: "Wiadomość z potwierdzeniem Twojego konta została wysłana na %{email}. Proszę postępować zgodnie z wskazówkami znajdującymi się w wiadomości celem aktywacji konta."
4
+ not_confirmed: "Wiadomość z potwierdzeniem Twojego konta została wysłana na '%{email}'. Proszę postępować zgodnie z wskazówkami znajdującymi się w wiadomości celem aktywacji konta."
5
5
  bad_credentials: "Nieprawidłowe dane logowania. Proszę spróbować ponownie."
6
6
  not_supported: "Proszę użyć POST /sign_in do zalogowania. GET nie jest obsługiwany."
7
7
  user_not_found: "Użytkownik nie został odnaleziony lub nie jest zalogowany."
8
8
  token_validations:
9
9
  invalid: "Nieprawidłowe dane logowania."
10
10
  registrations:
11
- missing_confirm_success_url: "Brak parametru `confirm_success_url`."
12
- redirect_url_not_allowed: "Przekierowanie na adres %{redirect_url} nie jest dozwolone."
13
- email_already_exists: "Konto z adresem %{email} już istnieje."
14
- account_with_uid_destroyed: "Konto z uid %{uid} zostało usunięte."
11
+ missing_confirm_success_url: "Brak parametru 'confirm_success_url'."
12
+ redirect_url_not_allowed: "Przekierowanie na adres '%{redirect_url}' nie jest dozwolone."
13
+ email_already_exists: "Konto z adresem '%{email}' już istnieje."
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
17
  passwords:
18
18
  missing_email: "Musisz wprowadzić adres e-mail."
19
19
  missing_redirect_url: "Brak adresu zwrotnego."
20
- not_allowed_redirect_url: "Przekierowanie na adres %{redirect_url} nie jest dozwolone."
21
- sended: "Wiadomość wysłana na adres %{email} zawiera instrukcje dotyczące zmiany hasła."
20
+ not_allowed_redirect_url: "Przekierowanie na adres '%{redirect_url}' nie jest dozwolone."
21
+ sended: "Wiadomość wysłana na adres '%{email}' zawiera instrukcje dotyczące zmiany hasła."
22
22
  user_not_found: "Nie odnaleziono użytkownika o adresie '%{email}'."
23
- password_not_required: "To konto nie wymaga podania hasła. Zaloguj się używając konta %{provider}."
24
- missing_passwords: 'Musisz wypełnić wszystkie pola z etykietą "hasło" oraz "potwierdzenie hasła".'
23
+ password_not_required: "To konto nie wymaga podania hasła. Zaloguj się używając konta '%{provider}'."
24
+ missing_passwords: "Musisz wypełnić wszystkie pola z etykietą 'Hasło' oraz 'Potwierdzenie hasła'."
25
25
  successfully_updated: "Twoje hasło zostało zaktualizowane."
26
26
  errors:
27
27
  validate_sign_up_params: "Proszę dostarczyć odpowiednie dane logowania w ciele zapytania."
@@ -37,14 +37,14 @@ pl:
37
37
  confirm_account_link: "Potwierdź swoje konto"
38
38
  reset_password_instructions:
39
39
  subject: "Instrukcje resetowania hasła"
40
- request_reset_link_msg: "Ktoś o link do zmiany hasła . Można to zrobić za pośrednictwem linku poniżej ."
40
+ request_reset_link_msg: "Ktoś o link do zmiany hasła. Można to zrobić za pośrednictwem linku poniżej."
41
41
  password_change_link: "Zmień hasło"
42
- ignore_mail_msg: "Jeśli jej nie potrzebuję , zignoruj ​​tę wiadomość."
43
- no_changes_msg: "Twoje hasło nie zmieni , dopóki dostęp powyższy link i utwórz nowy ."
42
+ ignore_mail_msg: "Jeśli jej nie potrzebuję, zignoruj ​​tę wiadomość."
43
+ no_changes_msg: "Twoje hasło nie zmieni, dopóki dostęp powyższy link i utwórz nowy."
44
44
  unlock_instructions:
45
45
  subject: "Instrukcje do odblokowania"
46
- account_lock_msg: "Twoje konto zostało zablokowane z powodu zbyt dużej liczby nieudanych znak w próbach ."
46
+ account_lock_msg: "Twoje konto zostało zablokowane z powodu zbyt dużej liczby nieudanych znak w próbach."
47
47
  unlock_link_msg: "Kliknij poniższy link, aby odblokować konto :"
48
48
  unlock_link: "Odblokować konto"
49
- hello: halo
50
- welcome: witam
49
+ hello: "halo"
50
+ welcome: "witam"
@@ -8,41 +8,38 @@ pt-BR:
8
8
  token_validations:
9
9
  invalid: "Dados de login inválidos."
10
10
  registrations:
11
- missing_confirm_success_url: "Parâmetro `confirm_success_url` não informado."
12
- redirect_url_not_allowed: "Redirecionamento para %{redirect_url} não permitido."
13
- email_already_exists: "Já existe uma conta com o email %{email}."
14
- account_with_uid_destroyed: "A conta com uid %{uid} foi excluída."
11
+ missing_confirm_success_url: "Parâmetro 'confirm_success_url' não informado."
12
+ redirect_url_not_allowed: "Redirecionamento para '%{redirect_url}' não permitido."
13
+ email_already_exists: "Já existe uma conta com o email '%{email}'."
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
17
  passwords:
18
18
  missing_email: "Informe o endereço de e-mail."
19
19
  missing_redirect_url: "URL para redirecionamento não informada."
20
- not_allowed_redirect_url: "Redirecionamento para %{redirect_url} não permitido."
20
+ not_allowed_redirect_url: "Redirecionamento para '%{redirect_url}' não permitido."
21
21
  sended: "Você receberá um e-mail com instruções sobre como redefinir sua senha."
22
22
  user_not_found: "Não existe um usuário com o e-mail '%{email}'."
23
- password_not_required: "Esta conta não necessita de uma senha. Faça login utilizando %{provider}."
23
+ password_not_required: "Esta conta não necessita de uma senha. Faça login utilizando '%{provider}'."
24
24
  missing_passwords: 'Preencha a senha e a confirmação de senha.'
25
25
  successfully_updated: "Senha atualizada com sucesso."
26
26
  errors:
27
- validate_sign_up_params: "Os dados submetidos na requisição de cadastro são inválidos."
28
- validate_account_update_params: "Os dados submetidos para atualização de conta são inválidos."
29
- not_email: "não é um e-mail"
30
27
  messages:
31
28
  already_in_use: "em uso"
29
+ validate_sign_up_params: "Os dados submetidos na requisição de cadastro são inválidos."
30
+ validate_account_update_params: "Os dados submetidos para atualização de conta são inválidos."
31
+ not_email: "não é um e-mail"
32
32
  devise:
33
33
  mailer:
34
34
  confirmation_instructions:
35
- subject: "Instruções de confirmação"
36
35
  confirm_link_msg: "Você pode confirmar a sua conta de e-mail através do link abaixo :"
37
36
  confirm_account_link: "Confirme conta"
38
37
  reset_password_instructions:
39
- subject: "Instruções para redefinir sua senha"
40
38
  request_reset_link_msg: "Alguém pediu um link para mudar sua senha. Você pode fazer isso através do link abaixo "
41
39
  password_change_link: "Alterar a senha"
42
40
  ignore_mail_msg: "Se você não pediu isso, por favor, ignore este e-mail."
43
41
  no_changes_msg: "Sua senha não será alterada até que você acessar o link acima e criar um novo."
44
42
  unlock_instructions:
45
- subject: "Instruções de desbloqueio"
46
43
  account_lock_msg: "A sua conta foi bloqueada devido a um número excessivo de sinal de sucesso em tentativas."
47
44
  unlock_link_msg: "Clique no link abaixo para desbloquear sua conta:"
48
45
  unlock_link: "Desbloquear minha conta"
@@ -8,20 +8,20 @@ pt:
8
8
  token_validations:
9
9
  invalid: "Dados de login inválidos."
10
10
  registrations:
11
- missing_confirm_success_url: "Parâmetro `confirm_success_url` não informado."
12
- redirect_url_not_allowed: "Redirecionamento para %{redirect_url} não permitido."
13
- email_already_exists: "Já existe uma conta com o email %{email}."
14
- account_with_uid_destroyed: "A conta com uid %{uid} foi excluída."
11
+ missing_confirm_success_url: "Parâmetro 'confirm_success_url' não informado."
12
+ redirect_url_not_allowed: "Redirecionamento para '%{redirect_url}' não permitido."
13
+ email_already_exists: "Já existe uma conta com o email '%{email}'."
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
17
  passwords:
18
18
  missing_email: "Informe o endereço de e-mail."
19
19
  missing_redirect_url: "URL para redirecionamento não informada."
20
- not_allowed_redirect_url: "Redirecionamento para %{redirect_url} não permitido."
20
+ not_allowed_redirect_url: "Redirecionamento para '%{redirect_url}' não permitido."
21
21
  sended: "Você receberá um e-mail com instruções sobre como redefinir sua senha."
22
22
  user_not_found: "Não existe um utilizador com o e-mail '%{email}'."
23
- password_not_required: "Esta conta não necessita de uma senha. Faça login utilizando %{provider}."
24
- missing_passwords: 'Preencha a senha e a confirmação de senha.'
23
+ password_not_required: "Esta conta não necessita de uma senha. Faça login utilizando '%{provider}'."
24
+ missing_passwords: "Preencha a senha e a confirmação de senha."
25
25
  successfully_updated: "Senha atualizada com sucesso."
26
26
  errors:
27
27
  validate_sign_up_params: "Os dados submetidos na requisição de registo são inválidos."
@@ -1,27 +1,27 @@
1
1
  ru:
2
2
  devise_token_auth:
3
3
  sessions:
4
- not_confirmed: "Письмо с подтверждением Вашей учетной записи %{email} отправлено на электронную почту. Вы должны следовать инструкциям, приведенным в письме, прежде чем Ваша учетная запись сможет быть активирована"
4
+ not_confirmed: "Письмо с подтверждением Вашей учетной записи '%{email}' отправлено на электронную почту. Вы должны следовать инструкциям, приведенным в письме, прежде чем Ваша учетная запись сможет быть активирована"
5
5
  bad_credentials: "Неверные логин или пароль. Пожалуйста, попробуйте еще раз."
6
6
  not_supported: "Используйте POST /sign_in для входа. GET запросы не поддерживаются."
7
7
  user_not_found: "Пользователь не найден или не вошел."
8
8
  token_validations:
9
- invalid: "Неверные данные для входа"
9
+ invalid: "Неверные логин или пароль."
10
10
  registrations:
11
- missing_confirm_success_url: "Отсутствует параметр `confirm_success_url`."
12
- redirect_url_not_allowed: "Переадресация на %{redirect_url} не разрешена."
13
- email_already_exists: "Учетная запись для %{email} уже существует"
14
- account_with_uid_destroyed: "Учетная запись с uid %{uid} удалена."
11
+ missing_confirm_success_url: "Отсутствует параметр 'confirm_success_url'."
12
+ redirect_url_not_allowed: "Переадресация на '%{redirect_url}' не разрешена."
13
+ email_already_exists: "Учетная запись для '%{email}' уже существует"
14
+ account_with_uid_destroyed: "Учетная запись с uid '%{uid}' удалена."
15
15
  account_to_destroy_not_found: "Не удается найти учетную запись для удаления."
16
16
  user_not_found: "Пользователь не найден."
17
17
  passwords:
18
18
  missing_email: "Вы должны указать адрес электронной почты."
19
19
  missing_redirect_url: "Отсутствует адрес переадресации."
20
- not_allowed_redirect_url: "Переадресация на %{redirect_url} не разрешена."
21
- sended: "Инструкция по восстановлению пароля отправлена на Вашу электронную почту %{email}."
20
+ not_allowed_redirect_url: "Переадресация на '%{redirect_url}' не разрешена."
21
+ sended: "Инструкция по восстановлению пароля отправлена на Вашу электронную почту '%{email}'."
22
22
  user_not_found: "Не удается найти пользователя с электронной почтой '%{email}'."
23
- password_not_required: "Эта учетная запись не требует пароля. Войдите используя учетную запись %{provider}."
24
- missing_passwords: 'Вы должны заполнить поля "пароль" и "повторите пароль".'
23
+ password_not_required: "Эта учетная запись не требует пароля. Войдите используя учетную запись '%{provider}'."
24
+ missing_passwords: "Вы должны заполнить поля 'пароль' и 'повторите пароль'."
25
25
  successfully_updated: "Ваш пароль успешно обновлён."
26
26
  errors:
27
27
  validate_sign_up_params: "Пожалуйста, укажите надлежащие данные для регистрации в теле запроса."
@@ -34,18 +34,18 @@ ru:
34
34
  confirmation_instructions:
35
35
  subject: "Инструкции подтверждения"
36
36
  confirm_link_msg: "Вы можете подтвердить ваш адрес электронной почты через ссылку ниже :"
37
- confirm_account_link: Подтвердите свой ​​счет
37
+ confirm_account_link: "Подтвердить свою учетную запись"
38
38
  reset_password_instructions:
39
39
  subject: "Инструкции для восстановления пароля"
40
- request_reset_link_msg: "Кто-то просил ссылку , чтобы изменить пароль . Вы можете сделать это через ссылку ниже."
40
+ request_reset_link_msg: "Кто-то запросил ссылку на изменение пароля. Вы можете сделать это через ссылку ниже."
41
41
  password_change_link: "Изменить пароль"
42
- ignore_mail_msg: "If you didn't request this, please ignore this email."
43
- no_changes_msg: "Ваш пароль не изменится, пока вы не открыть ссылку выше и создать новый."
42
+ ignore_mail_msg: "Если Вы не запрашивали это, Вы можете проигнорировать это письмо."
43
+ no_changes_msg: "Ваш пароль не изменится, пока вы не откроете ссылку выше и не создадите новый пароль."
44
44
  unlock_instructions:
45
45
  subject: "Разблокировать Инструкции"
46
- account_lock_msg: "Ваш аккаунт был заблокирован из-за чрезмерного количества неудачных попыток в знак ."
47
- unlock_link_msg: "Нажмите на ссылку ниже, чтобы разблокировать свой ​​аккаунт :"
48
- unlock_link: "Открой свой ​​аккаунт"
46
+ account_lock_msg: "Ваш аккаунт был заблокирован из-за чрезмерного количества неудачных попыток входа."
47
+ unlock_link_msg: "Нажмите на ссылку ниже, чтобы разблокировать свой аккаунт:"
48
+ unlock_link: "Разблокировать мою учетную запись"
49
49
  hello: "Здравствуйте"
50
- welcome: "Добро пожаловат"
50
+ welcome: "Добро пожаловать"
51
51
 
@@ -0,0 +1,49 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ zh-TW:
4
+ devise_token_auth:
5
+ sessions:
6
+ not_confirmed: "您將在幾分鐘後收到一封電子郵件'%{email}',內有驗證帳號的步驟說明。"
7
+ bad_credentials: "不正確的登入資料。請重試。"
8
+ not_supported: "請使用 POST /sign_in 進行登入. GET 是不支援的."
9
+ user_not_found: "未能找到帳號或未能成功登入。"
10
+ token_validations:
11
+ invalid: "不正確的登入資料。"
12
+ registrations:
13
+ missing_confirm_success_url: "欠缺數值 'confirm_success_url'"
14
+ redirect_url_not_allowed: "不支援轉向到'%{redirect_url}'"
15
+ email_already_exists: "電郵'%{email}'已被使用"
16
+ account_with_uid_destroyed: "帳號 '%{uid}' 已被移除。"
17
+ account_to_destroy_not_found: "無法找到目標帳號。"
18
+ user_not_found: "找不到帳號。"
19
+ passwords:
20
+ missing_email: "必需提供電郵。"
21
+ missing_redirect_url: "欠缺 redirect URL."
22
+ not_allowed_redirect_url: "不支援轉向到 '%{redirect_url}'"
23
+ sended: "您將在幾分鐘後收到一封電子郵件'%{email},內含可重新設定密碼連結的電子郵件。"
24
+ user_not_found: "找不到帳號 '%{email}'。"
25
+ password_not_required: "這不是一個需要密碼的帳號. 請使用 '%{provider}' 進行登入"
26
+ missing_passwords: "必需填寫'密碼'與'確認密碼'。"
27
+ successfully_updated: "您的密碼已被修改。"
28
+ errors:
29
+ messages:
30
+ already_in_use: "已被使用。"
31
+ validate_sign_up_params: "請在request body中填入有效的註冊內容"
32
+ validate_account_update_params: "請在request body中填入有效的更新帳號資料"
33
+ not_email: "這不是一個合適的電郵。"
34
+ devise:
35
+ mailer:
36
+ confirmation_instructions:
37
+ confirm_link_msg: "可以使用下面連結確定你的電郵"
38
+ confirm_account_link: "確定你的帳號"
39
+ reset_password_instructions:
40
+ request_reset_link_msg: "已申請修改您的密碼,你可以用下面連結進入"
41
+ password_change_link: "修改我的密碼"
42
+ ignore_mail_msg: "如你沒有申請,請忽略"
43
+ no_changes_msg: "在你點擊上面連結前,你的密碼都沒有改變"
44
+ unlock_instructions:
45
+ account_lock_msg: "由於多失敗登入,我們已鎖定你的帳號"
46
+ unlock_link_msg: "可以使用下面連結解鎖你的帳號"
47
+ unlock_link: "解鎖帳號"
48
+ hello: "你好"
49
+ welcome: "歡迎"
@@ -0,0 +1,49 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ zh-TW:
4
+ devise_token_auth:
5
+ sessions:
6
+ not_confirmed: "您將在幾分鐘後收到一封電子郵件'%{email}',內有驗證帳號的步驟說明。"
7
+ bad_credentials: "不正確的登入資料。請重試。"
8
+ not_supported: "請使用 POST /sign_in 進行登入. GET 是不支援的."
9
+ user_not_found: "未能找到帳號或未能成功登入。"
10
+ token_validations:
11
+ invalid: "不正確的登入資料。"
12
+ registrations:
13
+ missing_confirm_success_url: "欠缺數值 'confirm_success_url'"
14
+ redirect_url_not_allowed: "不支援轉向到'%{redirect_url}'"
15
+ email_already_exists: "電郵'%{email}'已被使用"
16
+ account_with_uid_destroyed: "帳號 '%{uid}' 已被移除。"
17
+ account_to_destroy_not_found: "無法找到目標帳號。"
18
+ user_not_found: "找不到帳號。"
19
+ passwords:
20
+ missing_email: "必需提供電郵。"
21
+ missing_redirect_url: "欠缺 redirect URL."
22
+ not_allowed_redirect_url: "不支援轉向到 '%{redirect_url}'"
23
+ sended: "您將在幾分鐘後收到一封電子郵件'%{email},內含可重新設定密碼連結的電子郵件。"
24
+ user_not_found: "找不到帳號 '%{email}'。"
25
+ password_not_required: "這不是一個需要密碼的帳號. 請使用 '%{provider}' 進行登入"
26
+ missing_passwords: "必需填寫'密碼'與'確認密碼'。"
27
+ successfully_updated: "您的密碼已被修改。"
28
+ errors:
29
+ messages:
30
+ already_in_use: "已被使用。"
31
+ validate_sign_up_params: "請在request body中填入有效的註冊內容"
32
+ validate_account_update_params: "請在request body中填入有效的更新帳號資料"
33
+ not_email: "這不是一個合適的電郵。"
34
+ devise:
35
+ mailer:
36
+ confirmation_instructions:
37
+ confirm_link_msg: "可以使用下面連結確定你的電郵"
38
+ confirm_account_link: "確定你的帳號"
39
+ reset_password_instructions:
40
+ request_reset_link_msg: "已申請修改您的密碼,你可以用下面連結進入"
41
+ password_change_link: "修改我的密碼"
42
+ ignore_mail_msg: "如你沒有申請,請忽略"
43
+ no_changes_msg: "在你點擊上面連結前,你的密碼都沒有改變"
44
+ unlock_instructions:
45
+ account_lock_msg: "由於多失敗登入,我們已鎖定你的帳號"
46
+ unlock_link_msg: "可以使用下面連結解鎖你的帳號"
47
+ unlock_link: "解鎖帳號"
48
+ hello: "你好"
49
+ welcome: "歡迎"
@@ -21,8 +21,8 @@ module DeviseTokenAuth
21
21
  # current_bloggers # Currently signed in user and admin
22
22
  #
23
23
  # Use:
24
- # before_filter :authenticate_blogger! # Redirects unless either a user or an admin are authenticated
25
- # before_filter ->{ authenticate_blogger! :admin } # Redirects to the admin login page
24
+ # before_action :authenticate_blogger! # Redirects unless either a user or an admin are authenticated
25
+ # before_action ->{ authenticate_blogger! :admin } # Redirects to the admin login page
26
26
  # current_blogger :user # Preferably returns a User if one is signed in
27
27
  #
28
28
  def devise_token_auth_group(group_name, opts={})
@@ -61,7 +61,9 @@ module DeviseTokenAuth
61
61
  end.compact
62
62
  end
63
63
 
64
- helper_method "current_#{group_name}", "current_#{group_name.to_s.pluralize}", "#{group_name}_signed_in?"
64
+ if respond_to?(:helper_method)
65
+ helper_method "current_#{group_name}", "current_#{group_name.to_s.pluralize}", "#{group_name}_signed_in?"
66
+ end
65
67
  METHODS
66
68
  end
67
69
 
@@ -72,7 +74,7 @@ module DeviseTokenAuth
72
74
  end
73
75
 
74
76
  # Define authentication filters and accessor helpers based on mappings.
75
- # These filters should be used inside the controllers as before_filters,
77
+ # These filters should be used inside the controllers as before_actions,
76
78
  # so you can control the scope of the user who should be signed in to
77
79
  # access that specific controller/action.
78
80
  # Example:
@@ -92,8 +94,8 @@ module DeviseTokenAuth
92
94
  # admin_session # Session data available only to the admin scope
93
95
  #
94
96
  # Use:
95
- # before_filter :authenticate_user! # Tell devise to use :user map
96
- # before_filter :authenticate_admin! # Tell devise to use :admin map
97
+ # before_action :authenticate_user! # Tell devise to use :user map
98
+ # before_action :authenticate_admin! # Tell devise to use :admin map
97
99
  #
98
100
  def self.define_helpers(mapping) #:nodoc:
99
101
  mapping = mapping.name
@@ -121,7 +123,9 @@ module DeviseTokenAuth
121
123
  METHODS
122
124
 
123
125
  ActiveSupport.on_load(:action_controller) do
124
- helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
126
+ if respond_to?(:helper_method)
127
+ helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
128
+ end
125
129
  end
126
130
  end
127
131
  end
@@ -18,7 +18,8 @@ module DeviseTokenAuth
18
18
  :default_password_reset_url,
19
19
  :redirect_whitelist,
20
20
  :check_current_password_before_update,
21
- :enable_standard_devise_support
21
+ :enable_standard_devise_support,
22
+ :remove_tokens_after_password_reset
22
23
 
23
24
  self.change_headers_on_each_request = true
24
25
  self.max_number_of_devices = 10
@@ -30,6 +31,7 @@ module DeviseTokenAuth
30
31
  self.redirect_whitelist = nil
31
32
  self.check_current_password_before_update = false
32
33
  self.enable_standard_devise_support = false
34
+ self.remove_tokens_after_password_reset = false
33
35
 
34
36
  def self.setup(&block)
35
37
  yield self
@@ -33,6 +33,9 @@ module ActionDispatch::Routing
33
33
  # get full url path as if it were namespaced
34
34
  full_path = "#{@scope[:path]}/#{opts[:at]}"
35
35
 
36
+ # get namespace name
37
+ namespace_name = @scope[:as]
38
+
36
39
  # clear scope so controller routes aren't namespaced
37
40
  @scope = ActionDispatch::Routing::Mapper::Scope.new(
38
41
  path: "",
@@ -43,7 +46,10 @@ module ActionDispatch::Routing
43
46
  parent: nil
44
47
  )
45
48
 
46
- devise_scope resource.underscore.gsub('/', '_').to_sym do
49
+ mapping_name = resource.underscore.gsub('/', '_')
50
+ mapping_name = "#{namespace_name}_#{mapping_name}" if namespace_name
51
+
52
+ devise_scope mapping_name.to_sym do
47
53
  # path to verify token validity
48
54
  get "#{full_path}/validate_token", controller: "#{token_validations_ctrl}", action: "validate_token"
49
55
 
@@ -1,3 +1,3 @@
1
1
  module DeviseTokenAuth
2
- VERSION = "0.1.37.beta4"
2
+ VERSION = "0.1.37"
3
3
  end
@@ -24,7 +24,7 @@ DeviseTokenAuth.setup do |config|
24
24
  # redirect successful authentications to '/omniauth/github/callback'
25
25
  # config.omniauth_prefix = "/omniauth"
26
26
 
27
- # By defult sending current password is not needed for the password update.
27
+ # By default sending current password is not needed for the password update.
28
28
  # Uncomment to enforce current_password param to be checked before all
29
29
  # attribute updates. Set it to :password if you want it to be checked only if
30
30
  # password is updated.
@@ -34,4 +34,4 @@ DeviseTokenAuth.setup do |config|
34
34
  # If, however, you wish to integrate with legacy Devise authentication, you can
35
35
  # do so by enabling this flag. NOTE: This feature is highly experimental!
36
36
  # enable_standard_devise_support = false
37
- end
37
+ end
@@ -284,6 +284,48 @@ class DemoUserControllerTest < ActionDispatch::IntegrationTest
284
284
  end
285
285
  end
286
286
 
287
+ describe 'successful password change' do
288
+ before do
289
+ DeviseTokenAuth.remove_tokens_after_password_reset = true
290
+
291
+ # adding one more token to simulate another logged in device
292
+ @old_auth_headers = @auth_headers
293
+ @auth_headers = @resource.create_new_auth_token
294
+ age_token(@resource, @client_id)
295
+ assert @resource.tokens.count > 1
296
+
297
+ # password changed from new device
298
+ @resource.update_attributes({
299
+ password: 'newsecret123',
300
+ password_confirmation: 'newsecret123'
301
+ })
302
+
303
+ get '/demo/members_only', {}, @auth_headers
304
+ end
305
+
306
+ after do
307
+ DeviseTokenAuth.remove_tokens_after_password_reset = false
308
+ end
309
+
310
+ it 'should have only one token' do
311
+ assert_equal 1, @resource.tokens.count
312
+ end
313
+
314
+ it 'new request should be successful' do
315
+ assert 200, response.status
316
+ end
317
+
318
+ describe 'another device should not be abble to login' do
319
+
320
+ it 'should return forbidden status' do
321
+ get '/demo/members_only', {}, @old_auth_headers
322
+ assert 401, response.status
323
+ end
324
+
325
+ end
326
+
327
+ end
328
+
287
329
  end
288
330
 
289
331
  describe 'enable_standard_devise_support' do