nsarno / knock

Seamless JWT authentication for Rails API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Config the entity model to a boolean param

dcalixto opened this issue · comments

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?