로그인
- + -




diff --git a/public/images/facebook.png b/public/images/facebook.png new file mode 100644 index 0000000..bacd84a Binary files /dev/null and b/public/images/facebook.png differ diff --git a/public/images/kakao.png b/public/images/kakao.png new file mode 100644 index 0000000..ecc97b2 Binary files /dev/null and b/public/images/kakao.png differ diff --git a/public/images/kakao_signup.png b/public/images/kakao_signup.png new file mode 100644 index 0000000..47957cd Binary files /dev/null and b/public/images/kakao_signup.png differ diff --git a/public/images/naver.png b/public/images/naver.png new file mode 100644 index 0000000..9c33f3e Binary files /dev/null and b/public/images/naver.png differ diff --git a/src/pages/LoginPage.js b/src/pages/LoginPage.js index 8d14fc0..a53b0a9 100644 --- a/src/pages/LoginPage.js +++ b/src/pages/LoginPage.js @@ -1,5 +1,7 @@ +import React, { useState } from "react"; import styled from "styled-components"; import Auth from "./Auth"; +import axios from 'axios'; import { useNavigate } from "react-router-dom"; const Div = styled.div` display: flex; @@ -107,6 +109,14 @@ const ProductBtn = styled.button` border-radius: 50%; width: 59px; height: 59px; + border: solid #D9D9D9; + background-color : white; + + > img { + width: auto; + display: block; + margin: auto; + } `; const KakaBtn = styled.button` width: 509px; @@ -116,6 +126,8 @@ const KakaBtn = styled.button` font-size: 22px; color: #4f4747; border: none; + text-decoration-line: none; + text-color: black; `; const SignBtn = styled.button` width: 509px; @@ -130,6 +142,8 @@ const AdverBtn = styled.button` margin-top: 63px; width: 506px; height: 243px; + border: none; + background-color: white; `; const Bottom1 = styled.footer` background-color: #007b59; @@ -183,9 +197,48 @@ const LoginPage = () => { const REST_API_KEY = "089967149185843522d3d4b4ae9a3b3d"; const REDIRECT_URI = "http://localhost:3000/oauth/kakao/callback"; const KAKAO_AUTH_URL = `https://kauth.kakao.com/oauth/authorize?client_id=${REST_API_KEY}&redirect_uri=${REDIRECT_URI}&response_type=code`; + const SERVER_URL = 'http://localhost:8080/'; const navigate = useNavigate(); + const pwdRegex = /^(?=.*[a-zA-Z])(?=.*[!@#$%^*+=-])(?=.*[0-9]).{8,12}$/; + const [loginInfo, setLoginInfo] = useState({ + email: '', + password: '' + }); + + const handleChange = (event) => { + setLoginInfo({...loginInfo, [event.target.name] : event.target.value}); + } + + const handleLogin = () => { + if(loginInfo.email === "") { + alert('이메일을 입력해주세요.'); + } else if(!pwdRegex.test(loginInfo.password)) { + alert('형식에 맞게 비밀번호를 입력해주세요.'); + } else { + axios.post(SERVER_URL + 'auth/login', + { + email: loginInfo.email, + password: loginInfo.password + } + ) + .then(response => { + if (response.ok) { + alert('반갑습니다!'); + navigate("/"); + } else { + alert('존재하지 않는 회원정보이거나 아이디/비밀번호가 틀렸습니다.'); + } + }) + .catch(err => console.error(err)) + } + } + + const handleSignUp = () => { + navigate("/selfAuth"); + } + return (




