闭社主体 forked from https://github.com/tootsuite/mastodon
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.

20 lines
542 B

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