Class: Monban::UseCase::Auth::Verify::ResetToken

Inherits:
Base
  • Object
show all
Includes:
Getto::InitializeWith
Defined in:
lib/monban/use_case/auth/verify/reset_token.rb

Instance Method Summary collapse

Instance Method Details

#verify(params) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/monban/use_case/auth/verify/reset_token.rb', line 21

def verify(params)
  Getto::Params.new.validate(params) do |v|
    v.hash(
      account_id:  v.integer                         {|val| param_error!(account_id: val) },
      reset_token: v.combine([v.string, v.not_empty]){|val| param_error!(reset_token: val) },
    )
  end or param_error!(params: params)

  repository.valid_reset_password_token?(
    account_id:  params[:account_id],
    reset_token: params[:reset_token],
    now:         time.now
  ) or error.invalid_account! "reset_token failed: #{params}"

  nil
end