Update authentication method
This commit is contained in:
15
slices/admin/repos/login_tokens_repo.rb
Normal file
15
slices/admin/repos/login_tokens_repo.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class LoginTokensRepo < Adamantium::Repo[:login_tokens]
|
||||
commands :create
|
||||
|
||||
def by_token(token:)
|
||||
login_tokens.where(token: token).one
|
||||
end
|
||||
|
||||
def delete_all
|
||||
login_tokens.delete
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
17
slices/admin/repos/user_repo.rb
Normal file
17
slices/admin/repos/user_repo.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class UserRepo < Adamantium::Repo[:users]
|
||||
commands :create
|
||||
|
||||
def exists(id)
|
||||
!!users
|
||||
.where(id: id)
|
||||
.one
|
||||
end
|
||||
|
||||
def by_email(email:)
|
||||
users.where(email: email).one
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user