-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/CDP-200-LoginMain #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ก Codex Review
Here are some automated review suggestions for this pull request.
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| validateLogin: () => { | ||
| const { email, password } = get(); | ||
|
|
||
| let emailError = false; | ||
| let passwordError = false; | ||
|
|
||
| // ์ด๋ฉ์ผ: ๋น์ด ์๊ฑฐ๋ ํ์์ด ์ฌ๋ฐ๋ฅด์ง ์์ผ๋ฉด ์๋ฌ | ||
| const trimmedEmail = email.trim(); | ||
| const isValidEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmedEmail); | ||
|
|
||
| if (!trimmedEmail || !isValidEmail) { | ||
| emailError = true; | ||
| } | ||
|
|
||
| // ๋น๋ฐ๋ฒํธ: 6์๋ฆฌ ์ด์ + ํน์๋ฌธ์ 1๊ฐ ์ด์ | ||
| const hasMinLength = password.length >= 6; | ||
| const hasSpecialChar = /[^A-Za-z0-9]/.test(password); | ||
|
|
||
| if (!hasMinLength || !hasSpecialChar) { | ||
| passwordError = true; | ||
| } | ||
|
|
||
| // ํ๋๋ผ๋ ์๋ฌ๊ฐ ์์ผ๋ฉด ํด๋น ํ๋ ๊ฐ ์ด๊ธฐํ + ์๋ฌ ํ๋๊ทธ ์ธํ | ||
| if (emailError || passwordError) { | ||
| set({ | ||
| email: emailError ? "" : email, | ||
| password: passwordError ? "" : password, | ||
| emailError, | ||
| passwordError, | ||
| }); | ||
| return false; | ||
| } | ||
|
|
||
| set({ emailError: false, passwordError: false }); | ||
| return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Persist trimmed email after validation
The validator trims whitespace to check the email format but, in the success path, the store keeps the original email string (emailError remains false and no set occurs with the trimmed value). A user who types " [email protected] " will pass validation, yet the state still contains the leading/trailing spaces; any subsequent login request that reads email from the store will send the untrimmed value and likely be rejected serverโside despite the UI reporting success. Store the trimmed email when validation passes or fail validation if whitespace is present.
Useful? React with ๐ย / ๐.
๐ Pull Request
๐ PR ์ ํ
๐ ๋ณ๊ฒฝ ์ฌํญ
AuthMain ๋ ์ด์์ ์ปดํฌ๋ํธ ์ถ๊ฐ
LoginForm ์ปดํฌ๋ํธ ์ถ๊ฐ
Form ์ํ๊ด๋ฆฌ store ์ถ๊ฐ
Auth Header ๋ฆฌํฉํ ๋ง
Input & Button variant ๋ฐ์ํ ๋ฆฌํฉํ ๋ง
๐ธ ์คํฌ๋ฆฐ์ท
๐ง ๊ด๋ จ ์ด์
๐ ๏ธ ์ต์ข ๋ฐฐํฌ ์ ๊ฒ ๋ฆฌ์คํธ
โ ์ต์ข ๋ฐฐํฌ ์ ๊ฒ ๊ฒฐ๊ณผ