nsarno / knock

Seamless JWT authentication for Rails API
MIT License
2.07k stars 253 forks source link

Config the entity model to a boolean param #247

Closed dcalixto closed 5 years ago

dcalixto commented 5 years ago

Hello, i'm trying to config the entity model to login if the confirmation_email is set to true, Everything is working very well beside this detail, as this kind of situation is not on the docs i'd like to know if this is possible with knock.

def self.from_token_request(request)
    email = request.params["auth"] && request.params["auth"]["email"]
    confirmation_email = request.params["auth"] && request.params["auth"]["confirmation_email"]
    self.find_by(email: email, confirmation_email: confirmation_email)
  end

So, i've trying to

def self.from_token_request(request)
    email = request.params["auth"] && request.params["auth"]["email"]
    confirmation_email = request.params["auth"] && request.params["auth"]["confirmation_email" ]
    self.find_by(email: email, confirmation_email: confirmation_email == true)
  end

Someone, can clarify about this?