mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 11:06:23 +00:00
refactor: restructure authentication components and routes
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 13s
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 13s
- Removed the old reset password form component and replaced it with a new implementation. - Updated routing paths for login, registration, and reset password to be under a common auth path. - Added new login and registration pages with corresponding forms. - Introduced a common auth header component for consistent branding across auth pages. - Implemented a current logged-in user display component. - Enhanced the register form to include email verification and captcha. - Updated translations for new and modified components. - Refactored the navigation bar to include user avatar dropdown and improved menu structure.
This commit is contained in:
@ -5,8 +5,10 @@ import { useRouter, usePathname } from "next/navigation"
|
||||
* 用于跳转到登录页并自动带上 redirect_back 参数
|
||||
* 用法:const toLogin = useToLogin(); <Button onClick={toLogin}>去登录</Button>
|
||||
*/
|
||||
export const loginPath = "/login"
|
||||
export const resetPasswordPath = "/reset-password"
|
||||
export const authPath = "/auth"
|
||||
export const loginPath = authPath + "/login"
|
||||
export const registerPath = authPath + "/register"
|
||||
export const resetPasswordPath = authPath + "/reset-password"
|
||||
|
||||
export function useToLogin() {
|
||||
const router = useRouter()
|
||||
@ -16,14 +18,6 @@ export function useToLogin() {
|
||||
}
|
||||
}
|
||||
|
||||
export function useToResetPassword() {
|
||||
const router = useRouter()
|
||||
const pathname = usePathname()
|
||||
return () => {
|
||||
router.push(`${resetPasswordPath}?redirect_back=${encodeURIComponent(pathname)}`)
|
||||
}
|
||||
}
|
||||
|
||||
export function useToUserProfile() {
|
||||
const router = useRouter();
|
||||
return (username: string) => {
|
||||
|
Reference in New Issue
Block a user