Advertisement
danilolsoares

Untitled

Nov 18th, 2019
2,424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.33 KB | None | 0 0
  1. class UsuarioAutenticado
  2.    def validar_token(token)
  3.        usuarios = UsuarioAutenticado.where(token: token)
  4.        if usuarios.count() == 1
  5.          usuario = usuarios.first
  6.          token = usuario.token
  7.          expiration_date = usuario.expiration_date
  8.          return expiration_date <= DateTime.now()
  9.        end
  10.        false
  11.    end
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement