1
0

passwords_controller.rb 636 B

12345678910111213141516171819202122232425
  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_body_classes
  5. layout 'auth'
  6. private
  7. def check_validity_of_reset_password_token
  8. unless reset_password_token_is_valid?
  9. flash[:error] = I18n.t('auth.invalid_reset_password_token')
  10. redirect_to new_password_path(resource_name)
  11. end
  12. end
  13. def set_body_classes
  14. @body_classes = 'lighter'
  15. end
  16. def reset_password_token_is_valid?
  17. resource_class.with_reset_password_token(params[:reset_password_token]).present?
  18. end
  19. end