-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
organizing and improving the admin panel and workflow
- Loading branch information
1 parent
1c2841e
commit 5a28e8c
Showing
17 changed files
with
2,187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { | ||
sendPasswordResetEmail, | ||
signInWithEmailAndPassword, | ||
} from "firebase/auth"; | ||
import { alert, prompt, snackbar } from "mdui"; | ||
import React from "react"; | ||
import { auth } from "../../firebase"; | ||
|
||
export default function Login() { | ||
const [email, setEmail] = React.useState(""); | ||
const [password, setPassword] = React.useState(""); | ||
|
||
const handleLogin = () => { | ||
signInWithEmailAndPassword(auth, email, password) | ||
.then((userCredential) => { | ||
console.log(userCredential); | ||
}) | ||
.catch((error) => { | ||
snackbar({ | ||
message: error.message, | ||
}); | ||
}); | ||
}; | ||
|
||
const handlePasswordReset = () => { | ||
prompt({ | ||
headline: "Passwort zurücksetzen", | ||
description: "Bitte gib deine Email-Adresse ein.", | ||
confirmText: "Senden", | ||
cancelText: "Abbrechen", | ||
closeOnOverlayClick: true, | ||
textFieldOptions: { | ||
placeholder: "user@example.com", | ||
type: "email", | ||
label: "Email", | ||
}, | ||
onConfirm: (email) => { | ||
sendPasswordResetEmail(auth, email) | ||
.then(() => { | ||
alert({ | ||
headline: "Email gesendet", | ||
description: "Bitte überprüfen Sie Ihren Posteingang.", | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
}); | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<mdui-card variant="filled" class="card"> | ||
<div className="mdui-prose"> | ||
<h1>Login</h1> | ||
<mdui-text-field | ||
value={email} | ||
onInput={(e) => setEmail(e.target.value)} | ||
type="email" | ||
placeholder="user@example.com" | ||
label="Email" | ||
/> | ||
<p /> | ||
<mdui-text-field | ||
value={password} | ||
onInput={(e) => setPassword(e.target.value)} | ||
type="password" | ||
label="Passwort" | ||
toggle-password | ||
/> | ||
<p /> | ||
<br /> | ||
<div className="button-container"> | ||
<mdui-button variant="text" onClick={handlePasswordReset}> | ||
Passwort zurücksetzen | ||
</mdui-button> | ||
<mdui-button onClick={handleLogin}>Login</mdui-button> | ||
</div> | ||
</div> | ||
</mdui-card> | ||
); | ||
} |
Oops, something went wrong.