Sha256: 97018fa9b6f786f95b670d36cafa47828df0c0ca32291dd7b2c3531d42f0670d

Contents?: true

Size: 438 Bytes

Versions: 2

Compression:

Stored size: 438 Bytes

Contents

module Jobshop
  class AuthenticationService
    attr_reader :email, :password

    def initialize(email, password)
      @email = email
      @password = password
    end

    def perform
      Jobshop::JWTService.encode(user_id: user.id) if user
    end

    private def user
      user = User.find_by(email: email)
      user && user.authenticate(password) ||
        raise(AuthenticationHandler::InvalidCredentials)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jobshop-0.0.163 app/services/jobshop/authentication_service.rb
jobshop-0.0.157 app/services/jobshop/authentication_service.rb