feat: new authenticate UI (#12172)

* enhance(ui): login form

* enhance(ui): add localization support with translate and locale management

* enhance(ui): WIP implement new authentication forms with context management

* enhance(ui): add password visibility toggle to input row

* enhance(ui): adjust padding for password visibility toggle

* enhance(i18n): implement internationalization support for authentication UI

* enhance(ui): implement sign in and sign up functionality with loading state

* enhance(ui): add session management and error handling in login form

* enhance(ui): add confirm code form and enhance authentication flow

* enhance(ui): improve sign-in flow and confirm code handling

* enhance(ui): add warning variant to alerts and improve error handling

* enhance(ui): implement countdown timer for code resend functionality

* enhance(ui): implement countdown timer for password reset and enhance login flow

* enhance(ui): export authentication and enhance UI components

* enhance(ui): integrate new login component and refresh token handling

* chore: clear amplify related codes

* enhance(i18n): normalize language codes and update locale handling

* enhance(auth): add multilingual support for signup and password reset flows

* enhance(ui): update login styles to inherit text color

* enhance(ui): adjust input color variables for improved accessibility

* enhance(auth): add password policy validation and tips in multiple languages

* enhance(ui): improve localization handling and update alert styles

* enhance(mobile): enhance login modal styling and accessibility

* fix(ui): update password validation regex for special characters

* enhance(ui): add padding to card header in login dialog

---------

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
This commit is contained in:
Charlie
2025-10-28 16:55:43 +08:00
committed by GitHub
parent 5b35a9ee49
commit a0a19a91fa
27 changed files with 2365 additions and 251 deletions

View File

@@ -108,6 +108,20 @@
(when (string/starts-with? key prefix)
(js/localStorage.removeItem key)))))
(defn auto-fill-refresh-token-from-cognito!
[]
(let [prefix "CognitoIdentityServiceProvider."
refresh-token-key (some #(when (string/starts-with? % prefix)
(when (string/ends-with? % "refreshToken")
%))
(js/Object.keys js/localStorage))]
(when refresh-token-key
(let [refresh-token (js/localStorage.getItem refresh-token-key)]
(when (and refresh-token (not= refresh-token "undefined"))
(state/set-auth-refresh-token refresh-token)
(js/localStorage.setItem "refresh-token" refresh-token)))))
)
(defn- clear-tokens
([]
(state/set-auth-id-token nil)
@@ -206,6 +220,7 @@
(:jwtToken (:idToken session))
(:jwtToken (:accessToken session))
(:token (:refreshToken session)))
(auto-fill-refresh-token-from-cognito!)
(state/pub-event! [:user/fetch-info-and-graphs]))
(defn ^:export login-with-username-password-e2e