Commit d4672581 authored by Spark's avatar Spark
Browse files

usingaircon 기능 복구, 로그인 웹사이트 opn=>replace로 변경, 로컬존재시 첫변경 cancel

parent 8f21573b
...@@ -12,7 +12,7 @@ import GetLocFirst from './pages/GetLocFirst'; ...@@ -12,7 +12,7 @@ import GetLocFirst from './pages/GetLocFirst';
function App() { function App() {
const isLs = localStorage.getItem('login') const isLs = localStorage.getItem('login')
function loginDefault() { function loginDefault() {
...@@ -29,7 +29,7 @@ function App() { ...@@ -29,7 +29,7 @@ function App() {
<Route path='/signup' component={SignupPage} /> <Route path='/signup' component={SignupPage} />
<Route path='/login' component={LoginPage} /> <Route path='/login' component={LoginPage} />
<Route path='/first-local-code' component={GetLocFirst} /> <Route path='/first-local-code' component={GetLocFirst} />
<PrivateRoute path='/edit'> <PrivateRoute path='/edit'>
<EditPage /> <EditPage />
</PrivateRoute> </PrivateRoute>
......
...@@ -36,15 +36,12 @@ function LoginComp() { ...@@ -36,15 +36,12 @@ function LoginComp() {
function addressUrl() { function addressUrl() {
const afterAt = emailAddress.split('@')[1] const afterAt = emailAddress.split('@')[1]
if (afterAt == ('naver.com' || 'gmail.com' || 'daum.net')) { if (afterAt) {
const newLink = 'https://www.' + afterAt; const newLink = 'https://www.' + afterAt;
window.open(newLink); window.location.replace(newLink);
} }
if (afterAt == 'korea.ac.kr') { else if (afterAt == 'korea.ac.kr') {
window.open('https://www.gmail.com'); window.location.replace('https://www.gmail.com');
}
else {
window.open();
} }
} }
...@@ -97,7 +94,7 @@ function LoginComp() { ...@@ -97,7 +94,7 @@ function LoginComp() {
<Form style={inboxstyled} onSubmit={handleSubmit}> <Form style={inboxstyled} onSubmit={handleSubmit}>
<FloatingLabel label="Email"> <FloatingLabel label="Email">
<Form.Control type="email" placeholder="Email" onChange={handleChange} required/> <Form.Control type="email" placeholder="Email" onChange={handleChange} required />
</FloatingLabel> </FloatingLabel>
<Button variant='light' className='mt-3' id='formbtn' type='submit'> <Button variant='light' className='mt-3' id='formbtn' type='submit'>
LOGIN LOGIN
......
import axios from "axios"; import axios from "axios";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Form } from "react-bootstrap"; import { Form } from "react-bootstrap";
import { callUserInfo, checkCookies } from "../utils/CheckDB"; import { callUserInfo } from "../utils/CheckDB";
import { isLogined } from "./../utils/Auth"; import { isLogined } from "./../utils/Auth";
import { routesClient } from './../routesClient'; import { routesClient } from './../routesClient';
function UsingAircon() { function UsingAircon() {
const [airUsing, setAirUsing] = useState(false); const [airUsing, setAirUsing] = useState('');
// useEffect(() => { console.log("change airUsing", airUsing);
// callUserInfo().then((res) => {
// if (isLogined()) {
// setAirUsing(res.using_aircon)
// }
// else {
// console.log(res)
// }
// })
// }, [checkCookies()])
function airChange() { async function airChange() {
setAirUsing(!airUsing); setAirUsing(!airUsing);
async function Useair() { await axios.get(routesClient.usingAircon, { using_aircon: !airUsing })
const res = await axios.get(routesClient.usingAircon);
console.log(res);
}
Useair();
} }
console.log("airUsing", airUsing); useEffect(() => {
callUserInfo().then((res) => {
setAirUsing(res[0]['using_aircon'])
})
}, [])
return ( return (
<> <>
......
...@@ -8,6 +8,7 @@ import ChartLine from '../components/ChartLine'; ...@@ -8,6 +8,7 @@ import ChartLine from '../components/ChartLine';
import ChartDoughnut from '../components/ChartDoughnut'; import ChartDoughnut from '../components/ChartDoughnut';
import Donation from '../components/Donation'; import Donation from '../components/Donation';
import LocCodeChange from '../components/LocCodeChange'; import LocCodeChange from '../components/LocCodeChange';
import { callUserInfo } from '../utils/CheckDB';
function GetLocFirst() { function GetLocFirst() {
const constyled = { const constyled = {
...@@ -31,13 +32,28 @@ function GetLocFirst() { ...@@ -31,13 +32,28 @@ function GetLocFirst() {
padding: '0' padding: '0'
} }
const [existLoc, setExistLoc] = useState('')
const [show, setShow] = useState(false)
useEffect(() => { useEffect(() => {
setTimeout(function () { callUserInfo().then((res) => {
setShow(true) setExistLoc(res[0]['loc_code'])
}, 1500) })
}, []) }, [])
const [show, setShow] = useState(false) useEffect(() => {
if (existLoc === '') {
setTimeout(function () {
setShow(true)
}, 1500)
}
else {
setShow(false)
window.location.replace('/')
}
}, [existLoc])
return ( return (
<Container className='m-auto d-flex position-relative' <Container className='m-auto d-flex position-relative'
......
...@@ -25,13 +25,10 @@ const postMail = async (email, token) => { ...@@ -25,13 +25,10 @@ const postMail = async (email, token) => {
from: `EUE Auth Supply <${envs.api.nodemailer.user}>`, from: `EUE Auth Supply <${envs.api.nodemailer.user}>`,
to: email, to: email,
subject: "EUE 사용자 계정 확인용 메일.", subject: "EUE 사용자 계정 확인용 메일.",
html: `<a href="${envs.server.protocol}://${envs.server.host}:${ html: `<a href="${envs.server.protocol}://${envs.server.host}:${envs.server.port
envs.server.port }${routes.base + routes.confirm}?token=${token}">${envs.server.protocol
}${routes.base + routes.confirm}?token=${token}">${ }://${envs.server.host}:${envs.server.port}${routes.base + routes.confirm
envs.server.protocol }?token=${token}</a>`,
}://${envs.server.host}:${envs.server.port}${
routes.base + routes.confirm
}?token=${token}</a>`,
}; };
try { try {
...@@ -161,6 +158,7 @@ export const getConfirm = async (req, res) => { ...@@ -161,6 +158,7 @@ export const getConfirm = async (req, res) => {
`${envs.client.protocol}://${envs.client.host}:${envs.client.port}/first-local-code` `${envs.client.protocol}://${envs.client.host}:${envs.client.port}/first-local-code`
); );
} catch (err) { } catch (err) {
console.log('22', err);
res.json({ msg: resForm.msg.err, contents: { error: err } }); res.json({ msg: resForm.msg.err, contents: { error: err } });
} }
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment