refactor(server): auth (#5895)

Remove `next-auth` and implement our own Authorization/Authentication system from scratch.

## Server

- [x] tokens
  - [x] function
  - [x] encryption

- [x] AuthController
  - [x] /api/auth/sign-in
  - [x] /api/auth/sign-out
  - [x] /api/auth/session
  - [x] /api/auth/session (WE SUPPORT MULTI-ACCOUNT!)

- [x] OAuthPlugin
  - [x] OAuthController
  - [x] /oauth/login
  - [x] /oauth/callback
  - [x] Providers
    - [x] Google
    - [x] GitHub

## Client

- [x] useSession
- [x] cloudSignIn
- [x] cloudSignOut

## NOTE:

Tests will be adding in the future
This commit is contained in:
liuyi
2024-03-12 10:00:09 +00:00
parent af49e8cc41
commit fb3a0e7b8f
148 changed files with 3407 additions and 2851 deletions

View File

@@ -406,10 +406,12 @@
"com.affine.appearanceSettings.windowFrame.description": "Customise appearance of Windows Client.",
"com.affine.appearanceSettings.windowFrame.frameless": "Frameless",
"com.affine.appearanceSettings.windowFrame.title": "Window frame style",
"com.affine.auth.change.email.message": "Your current email is {{email}}. Well send a temporary verification link to this email.",
"com.affine.auth.verify.email.message": "Your current email is {{email}}. Well send a temporary verification link to this email.",
"com.affine.auth.change.email.page.subtitle": "Please enter your new email address below. We will send a verification link to this email address to complete the process.",
"com.affine.auth.change.email.page.success.subtitle": "Congratulations! You have successfully updated the email address associated with your AFFiNE Cloud account.",
"com.affine.auth.change.email.page.success.title": "Email address updated!",
"com.affine.auth.verify.email.page.success.title": "Email address verified!",
"com.affine.auth.verify.email.page.success.subtitle": "Congratulations! You have successfully verified the email address associated with your AFFiNE Cloud account.",
"com.affine.auth.change.email.page.title": "Change email address",
"com.affine.auth.create.count": "Create Account",
"com.affine.auth.desktop.signing.in": "Signing in...",
@@ -430,11 +432,11 @@
"com.affine.auth.reset.password.message": "You will receive an email with a link to reset your password. Please check your inbox.",
"com.affine.auth.reset.password.page.success": "Password reset successful",
"com.affine.auth.reset.password.page.title": "Reset your AFFiNE Cloud password",
"com.affine.auth.send.change.email.link": "Send verification link",
"com.affine.auth.send.verify.email.hint": "Send verification link",
"com.affine.auth.send.reset.password.link": "Send reset link",
"com.affine.auth.send.set.password.link": "Send set link",
"com.affine.auth.sent": "Sent",
"com.affine.auth.sent.change.email.hint": "Verification link has been sent.",
"com.affine.auth.sent.verify.email.hint": "Verification link has been sent.",
"com.affine.auth.sent.change.email.fail": "The verification link failed to be sent, please try again later.",
"com.affine.auth.sent.change.password.hint": "Reset password link has been sent.",
"com.affine.auth.sent.reset.password.success.message": "Your password has upgraded! You can sign in AFFiNE Cloud with new password!",
@@ -951,7 +953,8 @@
"com.affine.settings.auto-check-description": "If enabled, it will automatically check for new versions at regular intervals.",
"com.affine.settings.auto-download-description": " If enabled, new versions will be automatically downloaded to the current device.",
"com.affine.settings.email": "Email",
"com.affine.settings.email.action": "Change Email",
"com.affine.settings.email.action.change": "Change Email",
"com.affine.settings.email.action.verify": "Verify Email",
"com.affine.settings.member-tooltip": "Enable AFFiNE Cloud to collaborate with others",
"com.affine.settings.noise-style": "Noise background on the sidebar",
"com.affine.settings.noise-style-description": "Use background noise effect on the sidebar.",