Skip to content

Commit c500d2b

Browse files
authored
Merge pull request #532 from sparcs-kaist/fix/remove-ldap-login
Fix/remove ldap login
2 parents ab2c7da + 6adb67d commit c500d2b

File tree

3 files changed

+59
-46
lines changed

3 files changed

+59
-46
lines changed

packages/api/src/auth/ldap.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const sanitize = (str: string) =>
1818
/**
1919
* Authenticate a user with LDAP
2020
*/
21+
/**
22+
* @deprecated Use google authentication instead
23+
*/
2124
export const authenticate = async (data: {
2225
username: string;
2326
password: string;

packages/api/src/auth/router.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import { Router } from "express";
22
import { loginHandler, gLoginHandler } from "./login";
33

44
const router = Router();
5-
5+
/**
6+
* @deprecated Use google authentication instead
7+
*/
68
router.post("/login", (req, res, next) => {
79
loginHandler(req, res).catch(next);
810
});
11+
912
router.post("/glogin", (req, res, next) => {
1013
gLoginHandler(req, res).catch(next);
1114
});

packages/web/src/components/pages/LoginPage.tsx

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { type FormEvent, useCallback, useState } from "react";
1+
import React, { useCallback, useState } from "react";
22
import { Navigate } from "react-router-dom";
33
import styled from "@emotion/styled";
44
import { motion } from "framer-motion";
@@ -8,10 +8,10 @@ import LandingImg from "@biseo/web/assets/landing.png";
88
import GoogleLogo from "@biseo/web/assets/google.png";
99
import { useAuth } from "@biseo/web/services/auth";
1010

11-
import { useInput } from "@biseo/web/common/hooks";
11+
// import { useInput } from "@biseo/web/common/hooks";
1212
import { theme } from "@biseo/web/theme";
1313
import { Box, Text } from "@biseo/web/components/atoms";
14-
import { text } from "@biseo/web/styles";
14+
// import { text } from "@biseo/web/styles";
1515
import { useGoogleLogin } from "@react-oauth/google";
1616

1717
const Page = styled.div`
@@ -36,32 +36,32 @@ const LoginTitle = styled(motion.div)`
3636
color: ${theme.colors.black};
3737
`;
3838

39-
const InputContainer = styled.input`
40-
width: 320px;
41-
height: 45px;
39+
// const InputContainer = styled.input`
40+
// width: 320px;
41+
// height: 45px;
4242

43-
box-sizing: border-box;
44-
padding: 9px 14px;
43+
// box-sizing: border-box;
44+
// padding: 9px 14px;
4545

46-
border: 1px solid ${theme.colors.gray300};
47-
border-radius: 5px;
48-
outline: none;
46+
// border: 1px solid ${theme.colors.gray300};
47+
// border-radius: 5px;
48+
// outline: none;
4949

50-
${text.subtitle}
50+
// ${text.subtitle}
5151

52-
&:hover {
53-
border: 1px solid ${theme.colors.gray400};
54-
}
52+
// &:hover {
53+
// border: 1px solid ${theme.colors.gray400};
54+
// }
5555

56-
&:focus {
57-
border: 1px solid ${theme.colors.blue300};
58-
box-shadow: 0px 0px 0px 3px ${theme.colors.blue200};
59-
}
60-
&::placeholder {
61-
font-size: 13px;
62-
color: ${theme.colors.gray300};
63-
}
64-
`;
56+
// &:focus {
57+
// border: 1px solid ${theme.colors.blue300};
58+
// box-shadow: 0px 0px 0px 3px ${theme.colors.blue200};
59+
// }
60+
// &::placeholder {
61+
// font-size: 13px;
62+
// color: ${theme.colors.gray300};
63+
// }
64+
// `;
6565

6666
const LoginButton = styled.button`
6767
width: 320px;
@@ -103,15 +103,15 @@ const LoginBackground = styled.img`
103103
`;
104104

105105
export const LoginPage: React.FC = () => {
106-
const { login, glogin, isLoggedIn } = useAuth(state => ({
107-
login: state.login,
106+
const { glogin, isLoggedIn } = useAuth(state => ({
107+
// login: state.login,
108108
glogin: state.glogin,
109109
isLoggedIn: !!state.userInfo,
110110
}));
111111
const [error, setError] = useState<boolean>(false);
112112

113-
const { input: username } = useInput();
114-
const { input: password } = useInput();
113+
// const { input: username } = useInput();
114+
// const { input: password } = useInput();
115115

116116
const easeMotion = {
117117
initial: { opacity: 0, scale: 0.5 },
@@ -123,16 +123,16 @@ export const LoginPage: React.FC = () => {
123123
},
124124
};
125125

126-
const handleLogin = useCallback(
127-
(e: FormEvent<HTMLFormElement>) => {
128-
e.preventDefault();
126+
// const handleLogin = useCallback(
127+
// (e: FormEvent<HTMLFormElement>) => {
128+
// e.preventDefault();
129129

130-
login(username.value, password.value)
131-
.then(() => console.log("Login success!"))
132-
.catch(() => setError(true));
133-
},
134-
[username.value, password.value],
135-
);
130+
// login(username.value, password.value)
131+
// .then(() => console.log("Login success!"))
132+
// .catch(() => setError(true));
133+
// },
134+
// [username.value, password.value],
135+
// );
136136
const handleGLogin = useCallback((code: string) => {
137137
glogin(code)
138138
.then(() => console.log("Login success!"))
@@ -163,7 +163,7 @@ export const LoginPage: React.FC = () => {
163163
쉽고 빠른 의사결정은, Biseo
164164
</LoginTitle>
165165
</Box>
166-
<form onSubmit={handleLogin}>
166+
{/* <form onSubmit={handleLogin}>
167167
<Box dir="column" gap={12} align="center">
168168
<InputContainer
169169
type="text"
@@ -191,13 +191,20 @@ export const LoginPage: React.FC = () => {
191191
</LoginButton>
192192
</Box>
193193
</Box>
194-
</form>
195-
<LoginButton onClick={googleLogin}>
196-
<img alt="google-logo" style={{ width: "20px" }} src={GoogleLogo} />
197-
<Text variant="boldtitle2" color="blue600">
198-
구글 로그인
199-
</Text>
200-
</LoginButton>
194+
</form> */}
195+
<Box dir="column" gap={8} align="flex-start">
196+
<LoginButton onClick={googleLogin}>
197+
<img alt="google-logo" style={{ width: "20px" }} src={GoogleLogo} />
198+
<Text variant="boldtitle2" color="blue600">
199+
구글 로그인
200+
</Text>
201+
</LoginButton>
202+
{error && (
203+
<Text variant="subtitle" color="blue600">
204+
아이디 또는 비밀번호가 올바르지 않습니다.
205+
</Text>
206+
)}
207+
</Box>
201208
<LoginBackground src={LandingImg} />
202209
</Page>
203210
);

0 commit comments

Comments
 (0)