You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
704 B

  1. # frozen_string_literal: true
  2. class Auth::PasswordsController < Devise::PasswordsController
  3. before_action :check_validity_of_reset_password_token, only: :edit
  4. before_action :set_pack
  5. before_action :set_body_classes
  6. layout 'auth'
  7. private
  8. def check_validity_of_reset_password_token
  9. unless reset_password_token_is_valid?
  10. flash[:error] = I18n.t('auth.invalid_reset_password_token')
  11. redirect_to new_password_path(resource_name)
  12. end
  13. end
  14. def set_body_classes
  15. @body_classes = 'lighter'
  16. end
  17. def reset_password_token_is_valid?
  18. resource_class.with_reset_password_token(params[:reset_password_token]).present?
  19. end
  20. def set_pack
  21. use_pack 'auth'
  22. end
  23. end