重构 monorepo 并完善网页端订阅与首页体验
- 迁移为 frontend-web、frontend-electron、backend-web 与 docker 部署结构 - 网页端:订阅门禁二次弹窗、套餐/支付组件化、顶栏分组对齐 - 首页:最近文件与模板库布局优化,缩略图对齐,下载与删除操作 - 新增管理后台、支付与云端文件 API,更新 README 与项目规范 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Soon\Api\Controllers;
|
||||
|
||||
use Soon\Api\Core\Json;
|
||||
use Soon\Api\Middleware\Auth;
|
||||
use Soon\Api\Services\AuthService;
|
||||
|
||||
final class AuthController
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$body = Json::readBody();
|
||||
$email = (string)($body['email'] ?? '');
|
||||
$password = (string)($body['password'] ?? '');
|
||||
Json::ok(AuthService::register($email, $password));
|
||||
}
|
||||
|
||||
public function login(): void
|
||||
{
|
||||
$body = Json::readBody();
|
||||
$email = (string)($body['email'] ?? '');
|
||||
$password = (string)($body['password'] ?? '');
|
||||
Json::ok(AuthService::login($email, $password));
|
||||
}
|
||||
|
||||
public function refresh(): void
|
||||
{
|
||||
$body = Json::readBody();
|
||||
$token = (string)($body['refresh_token'] ?? '');
|
||||
if ($token === '') {
|
||||
Json::fail('bad_request', '缺少 refresh_token', 400);
|
||||
}
|
||||
Json::ok(AuthService::refresh($token));
|
||||
}
|
||||
|
||||
public function me(): void
|
||||
{
|
||||
$user = Auth::require();
|
||||
unset($user['password_hash']);
|
||||
Json::ok($user);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user