feat(auth): add comprehensive authentication system with 2FA support

- Add new auth module with captcha, login, logout, register, and email verification endpoints
- Implement two-factor authentication with TOTP enable, disable, verify, and backup codes regeneration
- Create RSA public key endpoint for secure password encryption
- Add user profile management with get current user and email retrieval
- Integrate OpenAPI documentation for all authentication endpoints
- Implement password reset functionality with email verification flow
- Add comprehensive API response structures with proper error handling
- Configure all auth routes under /api/v1/auth scope with proper tagging
This commit is contained in:
zhenyi
2026-06-07 18:09:38 +08:00
parent 2bb5834167
commit 0d3b53f7a0
24 changed files with 816 additions and 10 deletions
+6 -6
View File
@@ -22,7 +22,7 @@ pub struct UpdateWikiPageParams {
}
impl RepoService {
/// 列出仓库的所有 wiki 页面
/// List all wiki pages in a repository.
pub async fn wiki_list_pages(
&self,
ctx: &Session,
@@ -69,7 +69,7 @@ impl RepoService {
}
}
/// 获取单个 wiki 页面
/// Get a single wiki page.
pub async fn wiki_get_page(
&self,
ctx: &Session,
@@ -94,7 +94,7 @@ impl RepoService {
.ok_or_else(|| AppError::NotFound("Wiki page not found".into()))
}
/// 创建 wiki 页面
/// Create a wiki page.
pub async fn wiki_create_page(
&self,
ctx: &Session,
@@ -160,7 +160,7 @@ impl RepoService {
Ok(page)
}
/// 更新 wiki 页面
/// Update a wiki page.
pub async fn wiki_update_page(
&self,
ctx: &Session,
@@ -231,7 +231,7 @@ impl RepoService {
Ok(updated)
}
/// 删除 wiki 页面(软删除)
/// Delete a wiki page using a soft delete.
pub async fn wiki_delete_page(
&self,
ctx: &Session,
@@ -259,7 +259,7 @@ impl RepoService {
ensure_affected(result.rows_affected(), "wiki page not found")
}
/// 回滚到历史版本
/// Revert a wiki page to a historical version.
pub async fn wiki_revert_to_version(
&self,
ctx: &Session,
+3 -3
View File
@@ -6,7 +6,7 @@ use crate::session::Session;
use super::util::clamp_limit_offset;
impl RepoService {
/// 获取页面的修订历史
/// Get the revision history for a page.
pub async fn wiki_get_revisions(
&self,
ctx: &Session,
@@ -34,7 +34,7 @@ impl RepoService {
.map_err(AppError::Database)
}
/// 获取特定版本的修订详情
/// Get details for a specific revision version.
pub async fn wiki_get_revision(
&self,
ctx: &Session,
@@ -60,7 +60,7 @@ impl RepoService {
.ok_or_else(|| AppError::NotFound("Revision not found".into()))
}
/// 比较两个版本的差异
/// Compare two revision versions.
pub async fn wiki_compare_revisions(
&self,
ctx: &Session,