Login Function added
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import {useState} from "react";
|
||||
import Button from "@/components/Button";
|
||||
|
||||
export default function Login() {
|
||||
|
||||
return (
|
||||
<div className="border">
|
||||
<login className={"login-container"}>
|
||||
<p className={"font-big-fat placement"}>Login</p>
|
||||
<div className={"placement"}>
|
||||
<br/>
|
||||
<p className={"font-kinda-big"}>Username</p>
|
||||
<input type="text" placeholder="Type here" className="input input-bordered input-sm w-full max-w-xs"/>
|
||||
<br/>
|
||||
<p className={"font-kinda-big"}>Password</p>
|
||||
<input type="text" placeholder="Type here" className="input input-bordered input-sm w-full max-w-xs"/>
|
||||
</div>
|
||||
<Button text={"Login"} color={"#e2001a"} width={"25px"}/>
|
||||
</login>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import {useState} from "react";
|
||||
import Button from "@/components/Button";
|
||||
|
||||
export default function Login() {
|
||||
|
||||
let url = "http://localhost:8080/users"
|
||||
|
||||
function on_login_click()
|
||||
{
|
||||
url += "?mail=" + inputUserName + "&password=" + inputPassword;
|
||||
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
}).then(r => console.log())
|
||||
}
|
||||
|
||||
const [inputUserName, setInputUserName] = useState("")
|
||||
const [inputPassword, setInputPassword] = useState("")
|
||||
|
||||
return (
|
||||
<div className="border">
|
||||
<login className={"login-container"}>
|
||||
<p className={"font-big-fat placement"}>Login</p>
|
||||
<div className={"placement"}>
|
||||
<br/>
|
||||
<p className={"font-kinda-big"}>Username</p>
|
||||
<input type="text" value={inputUserName} onChange={e => setInputUserName(e.target.value)} placeholder="Type here" className="input input-bordered input-sm w-full max-w-xs"/>
|
||||
<br/>
|
||||
<p className={"font-kinda-big"}>Password</p>
|
||||
<input type="password" value={inputPassword} onChange={e => setInputPassword(e.target.value)} placeholder="Type here" className="input input-bordered input-sm w-full max-w-xs"/>
|
||||
</div>
|
||||
<Button text={"Login"} color={"#e2001a"} width={"25px"} onClick={() => on_login_click()}/>
|
||||
</login>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import PopUp from "@/components/PopUp";
|
||||
import CalenderView from "@/components/CalenderView";
|
||||
import DateElement from "@/components/DateElement";
|
||||
import InputForm from "@/components/InputForm";
|
||||
import Login from "@/Tests/Login";
|
||||
import Login from "@/components/Login";
|
||||
import Test from "@/components/Test";
|
||||
|
||||
|
||||
@@ -20,13 +20,9 @@ export default function Home(p) {
|
||||
|
||||
return (
|
||||
|
||||
<>
|
||||
|
||||
|
||||
<div style={{height: 50}}></div>
|
||||
<Test/>
|
||||
|
||||
</>
|
||||
<div className={"login-window"}>
|
||||
<Login/>
|
||||
</div>
|
||||
|
||||
)
|
||||
}
|
||||
@@ -8,19 +8,22 @@
|
||||
--background-end-rgb: 255, 255, 255;
|
||||
}
|
||||
|
||||
/**
|
||||
Page Layouts
|
||||
*/
|
||||
|
||||
body {
|
||||
color: rgb(var(--foreground-rgb));
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent,
|
||||
rgb(var(--background-end-rgb))
|
||||
)
|
||||
rgb(var(--background-start-rgb));
|
||||
.login-window
|
||||
{
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -397,7 +400,6 @@ Login
|
||||
border-radius: 5px;
|
||||
font-family: Arial, serif;
|
||||
font-size: 16px;
|
||||
font-color: black;
|
||||
}
|
||||
|
||||
.border{
|
||||
@@ -407,7 +409,7 @@ Login
|
||||
border-radius: 5px;
|
||||
border-width: 2px;
|
||||
border-color: #1e2428;
|
||||
gap: 10px;
|
||||
/*gap: 10px;*/
|
||||
}
|
||||
.placement {
|
||||
display: flex;
|
||||
|
||||
@@ -14,5 +14,4 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [require("daisyui")],
|
||||
}
|
||||
|
||||
@@ -13,50 +13,50 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class ModuleController {
|
||||
private final DataBaseHandler db;
|
||||
|
||||
{
|
||||
db = DataBaseHandler.getInstance();
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("placeholder")
|
||||
public ResponseEntity<Module> getModule(
|
||||
@RequestParam(name="id") int id,
|
||||
@RequestParam(name="sessionid") String sessionID) {
|
||||
|
||||
User user = UserSessionIDHandler.getUserBySessionID(sessionID);
|
||||
|
||||
if (user != null){
|
||||
Module module = db.getModule(id);
|
||||
if(module != null) {
|
||||
return new ResponseEntity<>(module, HttpStatus.OK);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@GetMapping("placeholder")
|
||||
public ResponseEntity<Module> getModule(
|
||||
@RequestParam(name="name") String name,
|
||||
@RequestParam(name="sessionid") String sessionID) {
|
||||
|
||||
User user = UserSessionIDHandler.getUserBySessionID(sessionID);
|
||||
|
||||
if(user != null)
|
||||
{
|
||||
Module module = db.getModule(name);
|
||||
if (module != null) {
|
||||
return new ResponseEntity<>(module, HttpStatus.OK);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
|
||||
}
|
||||
// private final DataBaseHandler db;
|
||||
//
|
||||
// {
|
||||
// db = DataBaseHandler.getInstance();
|
||||
// }
|
||||
//
|
||||
// @CrossOrigin
|
||||
// @GetMapping("placeholder")
|
||||
// public ResponseEntity<Module> getModule(
|
||||
// @RequestParam(name="id") int id,
|
||||
// @RequestParam(name="sessionid") String sessionID) {
|
||||
//
|
||||
// User user = UserSessionIDHandler.getUserBySessionID(sessionID);
|
||||
//
|
||||
// if (user != null){
|
||||
// Module module = db.getModule(id);
|
||||
// if(module != null) {
|
||||
// return new ResponseEntity<>(module, HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
//
|
||||
// return new ResponseEntity<>(HttpStatus.FORBIDDEN);
|
||||
// }
|
||||
//
|
||||
// @CrossOrigin
|
||||
// @GetMapping("placeholder")
|
||||
// public ResponseEntity<Module> getModule(
|
||||
// @RequestParam(name="name") String name,
|
||||
// @RequestParam(name="sessionid") String sessionID) {
|
||||
//
|
||||
// User user = UserSessionIDHandler.getUserBySessionID(sessionID);
|
||||
//
|
||||
// if(user != null)
|
||||
// {
|
||||
// Module module = db.getModule(name);
|
||||
// if (module != null) {
|
||||
// return new ResponseEntity<>(module, HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
//
|
||||
// return new ResponseEntity<>(HttpStatus.FORBIDDEN);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user