Improved login admin page.
This commit is contained in:
parent
2aa67fb04f
commit
0e4937b50f
3 changed files with 88 additions and 16 deletions
|
@ -17,6 +17,7 @@
|
||||||
"lucide-react": "^0.356.0",
|
"lucide-react": "^0.356.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-hook-form": "^7.51.0",
|
||||||
"react-i18next": "^14.1.0",
|
"react-i18next": "^14.1.0",
|
||||||
"react-router-dom": "^6.22.3",
|
"react-router-dom": "^6.22.3",
|
||||||
"zustand": "^4.5.2"
|
"zustand": "^4.5.2"
|
||||||
|
|
|
@ -367,6 +367,8 @@ pre {
|
||||||
|
|
||||||
.login-background {
|
.login-background {
|
||||||
background-image: url("/fond.jpg");
|
background-image: url("/fond.jpg");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -374,6 +376,15 @@ pre {
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-inner-box div {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-inner-box [type=submit]{
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.login-textinput {
|
.login-textinput {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -387,7 +398,7 @@ pre {
|
||||||
.login-box {
|
.login-box {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 5px;
|
border-radius: 40px;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
@ -398,8 +409,12 @@ pre {
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-title {
|
.login-title {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
color: var(--etherpad-color);
|
color: var(--etherpad-color);
|
||||||
font-size: 2em;
|
font-size: 4rem;
|
||||||
|
font-weight: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-button {
|
.login-button {
|
||||||
|
@ -671,3 +686,42 @@ table tbody tr.active-row {
|
||||||
.pad-pagination >span {
|
.pad-pagination >span {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.login-page .login-form .input-control input[type=text], .login-page .login-form .input-control input[type=email], .login-page .login-form .input-control input[type=password], .login-page .signup-form .input-control input[type=text], .login-page .signup-form .input-control input[type=email], .login-page .signup-form .input-control input[type=password], .login-page .forgot-form .input-control input[type=text], .login-page .forgot-form .input-control input[type=email], .login-page .forgot-form .input-control input[type=password] {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px 20px;
|
||||||
|
margin: 8px 0;
|
||||||
|
display: inline-block;
|
||||||
|
border-bottom: 2px solid #ccc;
|
||||||
|
border-top: 0;
|
||||||
|
border-left: 0;
|
||||||
|
border-right: 0;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
-webkit-transition: all 0.3s ease-in-out;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, button, select, optgroup, textarea {
|
||||||
|
margin: 0;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-input {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-input svg {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
right: 10px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,23 @@
|
||||||
import {useState} from "react";
|
|
||||||
import {useStore} from "../store/store.ts";
|
import {useStore} from "../store/store.ts";
|
||||||
import {useNavigate} from "react-router-dom";
|
import {useNavigate} from "react-router-dom";
|
||||||
|
import {SubmitHandler, useForm} from "react-hook-form";
|
||||||
|
import {Eye, EyeOff} from "lucide-react";
|
||||||
|
import {useState} from "react";
|
||||||
|
|
||||||
|
type Inputs = {
|
||||||
|
username: string
|
||||||
|
password: string
|
||||||
|
}
|
||||||
|
|
||||||
export const LoginScreen = ()=>{
|
export const LoginScreen = ()=>{
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [username, setUsername] = useState('')
|
const [passwordVisible, setPasswordVisible] = useState<boolean>(false)
|
||||||
const [password, setPassword] = useState('')
|
|
||||||
|
|
||||||
const login = ()=>{
|
const {
|
||||||
|
register,
|
||||||
|
handleSubmit} = useForm<Inputs>()
|
||||||
|
|
||||||
|
const login: SubmitHandler<Inputs> = ({username,password})=>{
|
||||||
fetch('/admin-auth/', {
|
fetch('/admin-auth/', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers:{
|
headers:{
|
||||||
|
@ -28,17 +38,24 @@ export const LoginScreen = ()=>{
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className="login-background">
|
return <div className="login-background login-page">
|
||||||
<div className="login-box">
|
<div className="login-box login-form">
|
||||||
<h1 className="login-title">Login Etherpad</h1>
|
<h1 className="login-title">Etherpad</h1>
|
||||||
<div className="login-inner-box">
|
<form className="login-inner-box input-control" onSubmit={handleSubmit(login)}>
|
||||||
<div>Username</div>
|
<div>Username</div>
|
||||||
<input className="login-textinput" type="text" name="username" value={username} onChange={v => setUsername(v.target.value)} placeholder="Username"/>
|
<input {...register('username', {
|
||||||
|
required: true
|
||||||
|
})} className="login-textinput input-control" type="text" placeholder="Username"/>
|
||||||
<div>Passwort</div>
|
<div>Passwort</div>
|
||||||
<input className="login-textinput" type="password" name="password" value={password}
|
<span className="icon-input">
|
||||||
onChange={v => setPassword(v.target.value)} placeholder="Password"/>
|
<input {...register('password', {
|
||||||
<input type="button" value="Login" onClick={login} className="login-button"/>
|
required: true
|
||||||
</div>
|
})} className="login-textinput" type={passwordVisible?"text":"password"} placeholder="Password"/>
|
||||||
|
{passwordVisible? <Eye onClick={()=>setPasswordVisible(!passwordVisible)}/> :
|
||||||
|
<EyeOff onClick={()=>setPasswordVisible(!passwordVisible)}/>}
|
||||||
|
</span>
|
||||||
|
<input type="submit" value="Login" className="login-button"/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue