removed blade and htmx
This commit is contained in:
@@ -9,7 +9,6 @@ use Illuminate\Support\Str;
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\LucentException;
|
||||
use Lucent\Mail\LoginMail;
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
readonly class AuthServiceLucent implements AuthService
|
||||
{
|
||||
@@ -41,8 +40,8 @@ readonly class AuthServiceLucent implements AuthService
|
||||
name: new Name($this->session->get("user.name")),
|
||||
email: new Email($this->session->get("user.email")),
|
||||
roles: $this->session->get("user.roles"),
|
||||
createdAt: $this->session->get("user.createdAt"),
|
||||
updatedAt: $this->session->get("user.updatedAt"),
|
||||
createdAt: Carbon::parse($this->session->get("user.createdAt")),
|
||||
updatedAt: Carbon::parse($this->session->get("user.updatedAt")),
|
||||
loggedInAt: null,
|
||||
mailToken: null,
|
||||
);
|
||||
@@ -81,7 +80,7 @@ readonly class AuthServiceLucent implements AuthService
|
||||
}
|
||||
|
||||
$newUser = $user->get();
|
||||
$newUser->updatedAt = Carbon::now()->toJson();
|
||||
$newUser->updatedAt = Carbon::now();
|
||||
$newUser->mailToken = null;
|
||||
$this->userRepo->update($newUser);
|
||||
$this->session->put(["user" => $user->get()->safe()]);
|
||||
@@ -110,9 +109,9 @@ readonly class AuthServiceLucent implements AuthService
|
||||
name: new Name($name),
|
||||
email: new Email($email),
|
||||
roles: $this->validateRoles($roles),
|
||||
createdAt: Carbon::now()->toJson(),
|
||||
updatedAt: Carbon::now()->toJson(),
|
||||
loggedInAt: Carbon::now()->toJson(),
|
||||
createdAt: Carbon::now(),
|
||||
updatedAt: Carbon::now(),
|
||||
loggedInAt: Carbon::now(),
|
||||
mailToken: Token::new(32),
|
||||
);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ interface UserRepo
|
||||
*/
|
||||
public function all(): Collection;
|
||||
|
||||
public static function insert(User $user): void;
|
||||
public function insert(User $user): void;
|
||||
|
||||
public function update(User $user): void;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class UserRepoLucent implements UserRepo
|
||||
return new Collection($users);
|
||||
}
|
||||
|
||||
public static function insert(User $user): void
|
||||
public function insert(User $user): void
|
||||
{
|
||||
$userData = toArray($user);
|
||||
$userData["roles"] = json_encode($userData["roles"]);
|
||||
|
||||
@@ -30,7 +30,7 @@ class UserRepoLunar implements UserRepo
|
||||
return new Collection($users);
|
||||
}
|
||||
|
||||
public static function insert(User $user): void
|
||||
public function insert(User $user): void
|
||||
{
|
||||
$userData = toArray($user);
|
||||
$userData["roles"] = json_encode($userData["roles"]);
|
||||
|
||||
@@ -67,22 +67,35 @@ class AuthController
|
||||
);
|
||||
}
|
||||
|
||||
return view("lucent::auth.login");
|
||||
return $this->svelte->render(
|
||||
layout: "account",
|
||||
view: "login",
|
||||
title: "Login",
|
||||
);
|
||||
}
|
||||
|
||||
public function postLogin(Request $request)
|
||||
{
|
||||
$this->authService->sendLoginEmail($request->input("email"));
|
||||
|
||||
return view("lucent::auth.login-success");
|
||||
return [];
|
||||
}
|
||||
|
||||
public function verify(Request $request): View
|
||||
{
|
||||
return view("lucent::auth.verify", [
|
||||
"email" => $request->input("email"),
|
||||
"token" => $request->input("token"),
|
||||
]);
|
||||
// return view("lucent::auth.verify", [
|
||||
// "email" => $request->input("email"),
|
||||
// "token" => $request->input("token"),
|
||||
// ]);
|
||||
|
||||
return $this->svelte->render(
|
||||
layout: "account",
|
||||
view: "verify",
|
||||
title: "Enter",
|
||||
data: [
|
||||
"email" => $request->input("email"),
|
||||
"token" => $request->input("token"),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public function postVerify(Request $request)
|
||||
|
||||
@@ -56,7 +56,6 @@ class HomeController extends Controller
|
||||
return ok([
|
||||
"users" => $users,
|
||||
"records" => $graph->getRootRecords()->toArray(),
|
||||
"graph" => toArray($graph),
|
||||
"modalUrl" => $request->fullUrl(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use Illuminate\Support\ServiceProvider;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Lucent\Account\AuthService;
|
||||
use Lucent\Account\AuthServiceLunar;
|
||||
use Lucent\Account\AuthServiceLucent;
|
||||
use Lucent\Account\UserRepo;
|
||||
use Lucent\Account\UserRepoLucent;
|
||||
use Lucent\Account\UserRepoLunar;
|
||||
@@ -51,7 +52,10 @@ class LucentServiceProvider extends ServiceProvider
|
||||
});
|
||||
|
||||
$this->app->bind(AuthService::class, function ($app) {
|
||||
return $app->make(AuthServiceLunar::class);
|
||||
return match ($app->make(ChannelService::class)->channel->auth) {
|
||||
ChannelAuth::LUNAR => $app->make(AuthServiceLunar::class),
|
||||
ChannelAuth::LUCENT => $app->make(AuthServiceLucent::class),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@ class Svelte
|
||||
mixed $data = [],
|
||||
): View|Factory {
|
||||
$context = [];
|
||||
$context["user"] = toArray($this->authService->getCurrentUser());
|
||||
$context["user"] = $this->authService->isLoggedIn()
|
||||
? $this->authService->getCurrentUser()
|
||||
: null;
|
||||
$context["view"] = $view;
|
||||
$context["layout"] = $layout;
|
||||
$context["title"] = $title;
|
||||
|
||||
Reference in New Issue
Block a user