Skip to content

Commit

Permalink
Merge pull request #25 from handong-app/junglesub/feat/final-touch
Browse files Browse the repository at this point in the history
Junglesub/feat/final touch
  • Loading branch information
junglesub authored Oct 15, 2024
2 parents 1ede3e7 + cef0e26 commit 9b6bfe9
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/main/front/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
<div id="root"></div>
<!-- Vite injects your JavaScript here -->
<script type="module" src="/src/main.jsx"></script>
<script>
setTimeout(() => {
const rootElement = document.getElementById("root");
if (rootElement && rootElement.innerText.trim() === "") {
document.write(
"무언가 잘못되었어요. 새로고침을 하시고 안되시면 <a href='https://board.handong.app/feed' target='_blank' rel='noopener noreferrer'>https://board.handong.app/feed</a> 에서 공지사항을 확인해주세요"
);
}
}, 3000);
</script>
</body>
</html>
142 changes: 142 additions & 0 deletions src/main/front/src/components/MainDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import ListItemText from "@mui/material/ListItemText";
import InboxIcon from "@mui/icons-material/MoveToInbox";
import FavoriteIcon from "@mui/icons-material/Favorite";
import ViewListIcon from "@mui/icons-material/ViewList";
import GitHubIcon from "@mui/icons-material/GitHub";
import InfoIcon from "@mui/icons-material/Info";
import {
Badge,
BottomNavigation,
Expand Down Expand Up @@ -212,6 +214,146 @@ export default function MainDrawer() {
</ListItem>
</Tooltip>
))}
<Tooltip
title="Github"
placement="right"
arrow
slotProps={{
popper: {
modifiers: [
{
name: "offset",
options: {
offset: [0, -14],
},
},
],
},
}}
>
<ListItem disablePadding sx={{ display: "block" }}>
<ListItemButton
component="a"
href="https://github.com/orgs/handong-app/repositories?q=handong-feed"
target="_blank"
rel="noopener noreferrer"
sx={[
{
minHeight: 48,
px: 2.5,
my: 1.1,
},
open
? {
justifyContent: "initial",
}
: {
justifyContent: "center",
},
]}
>
<ListItemIcon
sx={[
{
minWidth: 0,
justifyContent: "center",
},
open
? {
mr: 3,
}
: {
mr: "auto",
},
]}
>
<GitHubIcon />
</ListItemIcon>
<ListItemText
primary="Github"
sx={[
open
? {
opacity: 1,
}
: {
opacity: 0,
},
]}
/>
</ListItemButton>
</ListItem>
</Tooltip>
<Tooltip
title="Website"
placement="right"
arrow
slotProps={{
popper: {
modifiers: [
{
name: "offset",
options: {
offset: [0, -14],
},
},
],
},
}}
>
<ListItem disablePadding sx={{ display: "block" }}>
<ListItemButton
component="a"
href="https://board.handong.app/feed"
target="_blank"
rel="noopener noreferrer"
sx={[
{
minHeight: 48,
px: 2.5,
my: 1.1,
},
open
? {
justifyContent: "initial",
}
: {
justifyContent: "center",
},
]}
>
<ListItemIcon
sx={[
{
minWidth: 0,
justifyContent: "center",
},
open
? {
mr: 3,
}
: {
mr: "auto",
},
]}
>
<InfoIcon />
</ListItemIcon>
<ListItemText
primary="Website"
sx={[
open
? {
opacity: 1,
}
: {
opacity: 0,
},
]}
/>
</ListItemButton>
</ListItem>
</Tooltip>
</List>
</Box>
</Drawer>
Expand Down
39 changes: 38 additions & 1 deletion src/main/front/src/components/MyAppbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import Menu from "@mui/material/Menu";
import Container from "@mui/material/Container";
import MenuItem from "@mui/material/MenuItem";
import FeedIcon from "@mui/icons-material/Feed";
import { Slide, useScrollTrigger } from "@mui/material";
import GitHubIcon from "@mui/icons-material/GitHub";
import InfoIcon from "@mui/icons-material/Info";

import { IconButton, Slide, Tooltip, useScrollTrigger } from "@mui/material";

const settings = ["Profile", "Account", "Dashboard", "Logout"];

Expand Down Expand Up @@ -70,6 +73,40 @@ function MyAppbar() {
한동피드
</Typography>

<Box
sx={{
flexGrow: 0,
position: "absolute",
display: "flex",
right: 0,
}}
>
<Tooltip title="Github">
<IconButton
color="inherit"
component="a"
href="https://github.com/orgs/handong-app/repositories?q=handong-feed"
target="_blank"
rel="noopener noreferrer"
aria-label="Github"
>
<GitHubIcon />
</IconButton>
</Tooltip>
<Tooltip title="Website">
<IconButton
color="inherit"
component="a"
href="https://board.handong.app/feed"
target="_blank"
rel="noopener noreferrer"
aria-label="Website"
>
<InfoIcon />
</IconButton>
</Tooltip>
</Box>

{/* <Box
sx={{
flexGrow: 1,
Expand Down
4 changes: 3 additions & 1 deletion src/main/front/src/pages/MainScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { GoogleOAuthProvider, GoogleLogin } from "@react-oauth/google";
import { googleClientId } from "../constants";
import { useRecoilValue, useResetRecoilState, useSetRecoilState } from "recoil";
import { authJwtAtom } from "../recoil/authAtom";
import { useNavigate } from "react-router-dom";

import "./MainScreen.scss";

const GoogleLoginComponent = () => {
const navigate = useNavigate();
const setJwt = useSetRecoilState(authJwtAtom);
const handleLoginSuccess = (credentialResponse) => {
console.log("Encoded JWT ID token: " + credentialResponse.credential);
Expand All @@ -24,7 +26,7 @@ const GoogleLoginComponent = () => {
if (data.token) {
localStorage.setItem("happ_feed_token", JSON.stringify(data.token)); // Incase of strictmode error
setJwt(data.token);
// navigate("/feed");
navigate("/");
} else {
alert("Login failed: " + data.message);
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/thc/realspr/service/GoogleAuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public String[] verifyGoogleToken(String credential) {
GoogleIdToken idToken = verifier.verify(credential);
if (idToken != null) {
GoogleIdToken.Payload payload = idToken.getPayload();
String[] out = {idToken.getPayload().getEmail(), payload.getEmail()};
return out;
return new String[]{payload.getEmail(), payload.get("name").toString()};
} else {
throw new RuntimeException("Invalid ID token");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public TbuserDto.CreateResDto loginWithGoogle(String credential) {


// 유저가 @handong.ac.kr 이메일이 아니면 예외 처리
// if (email == null || !email.endsWith("@handong.ac.kr")) {
// throw new NoAuthorizationException("Unauthorized user");
// }
if (email == null || !email.endsWith("@handong.ac.kr")) {
throw new NoAuthorizationException("Not Handong User");
}

Tbuser tbuser = tbuserRepository.findByEmail(email);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/thc/realspr/util/TokenFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class TokenFactory {
// private final String SECRET_KEY = "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";

static String temp_key = "21098765432109876543210987654321";
static int intervalRefreshToken = 86400; // 1 day
static int intervalRefreshToken = 86400 * 7; // 7 days
int intervalAccessToken = 6000;

public static String issueRefreshToken(String tbuserId) {
Expand Down

0 comments on commit 9b6bfe9

Please sign in to comment.