StandardRB
This commit is contained in:
@@ -5,7 +5,7 @@ module Admin
|
||||
include Deps["commands.sessions.create"]
|
||||
|
||||
def handle(req, res)
|
||||
create.(email: req.params[:email])
|
||||
create.call(email: req.params[:email])
|
||||
|
||||
res.redirect_to "/admin"
|
||||
end
|
||||
|
@@ -5,7 +5,7 @@ module Admin
|
||||
include Deps["commands.sessions.validate"]
|
||||
|
||||
def handle(req, res)
|
||||
user_id = validate.(token: req.params[:token])
|
||||
user_id = validate.call(token: req.params[:token])
|
||||
session = req.env["rack.session"]
|
||||
|
||||
session[:user_id] = user_id
|
||||
|
@@ -9,7 +9,7 @@ module Admin
|
||||
bookmark = bookmark_repo.fetch(id: bookmark_id)
|
||||
|
||||
page_cacher.call(url: bookmark.url) do |content|
|
||||
bookmark_repo.update(id: bookmark_id, params: { cached_content: content })
|
||||
bookmark_repo.update(id: bookmark_id, params: {cached_content: content})
|
||||
end
|
||||
|
||||
Success()
|
||||
|
@@ -5,8 +5,8 @@ module Admin
|
||||
module Sessions
|
||||
class Create
|
||||
include Deps[
|
||||
"repos.login_tokens_repo",
|
||||
"repos.user_repo"
|
||||
"repos.login_tokens_repo",
|
||||
"repos.user_repo"
|
||||
]
|
||||
|
||||
def call(email:)
|
||||
@@ -37,7 +37,7 @@ module Admin
|
||||
body "#{app_settings.micropub_site_url}/admin/login/#{token.token}"
|
||||
end
|
||||
|
||||
mail[:to] = email
|
||||
mail[:to] = user.email
|
||||
mail[:from] = app_settings.from_email
|
||||
|
||||
mail.deliver
|
||||
|
@@ -12,13 +12,9 @@ module Admin
|
||||
return nil
|
||||
end
|
||||
|
||||
user_id = token.user_id
|
||||
|
||||
if user_id
|
||||
user_id
|
||||
end
|
||||
token.user_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -3,7 +3,7 @@ require "adamantium/middleware/authenticate"
|
||||
module Adamantium
|
||||
class AuthenticatedAdminAction
|
||||
def self.call(action:)
|
||||
auth_proc = -> (id) { Admin::Container["repos.user_repo"].exists(id) }
|
||||
auth_proc = ->(id) { Admin::Container["repos.user_repo"].exists(id) }
|
||||
action_proc = ->(env) { Admin::Container["actions.#{action}"].call(env) }
|
||||
|
||||
Adamantium::Middleware::Authenticate.new(action_proc, auth_proc)
|
||||
|
@@ -8,10 +8,10 @@ html
|
||||
|
||||
title Admin // Daniel Nitsikopoulos
|
||||
|
||||
= stylesheet_tag "app"
|
||||
= stylesheet_tag "admin/app"
|
||||
link rel="icon" type="image/x-icon" href="/assets/favicon.ico"
|
||||
|
||||
= javascript_tag "app"
|
||||
= javascript_tag "admin/app"
|
||||
|
||||
script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"
|
||||
script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer="true"
|
||||
|
Reference in New Issue
Block a user