ApiController: check token validity for a given admin
This commit is contained in:
parent
d576d426f4
commit
4a04f2e59f
3 changed files with 43 additions and 42 deletions
|
@ -43,6 +43,12 @@ class Administrateur < ApplicationRecord
|
|||
api_token
|
||||
end
|
||||
|
||||
def valid_api_token?(api_token)
|
||||
BCrypt::Password.new(encrypted_token) == api_token
|
||||
rescue BCrypt::Errors::InvalidHash
|
||||
false
|
||||
end
|
||||
|
||||
def registration_state
|
||||
if active?
|
||||
'Actif'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue