mirror of
https://github.com/hexahigh/portfolio.git
synced 2025-12-12 03:25:06 +01:00
firebase authentication is hard. i think i will stick to static pages
This commit is contained in:
parent
713f11bfff
commit
5df1032240
@ -37,22 +37,10 @@ const firebaseConfig = {
|
||||
|
||||
// Initialize Firebase
|
||||
const app = initializeApp(firebaseConfig);
|
||||
const auth = getAuth(app);
|
||||
export const auth = getAuth(app);
|
||||
const provider = new GoogleAuthProvider()
|
||||
const analytics = getAnalytics(app);
|
||||
|
||||
// Check if google sign up button is pressed
|
||||
document.getElementById("googleSignButton").addEventListener("click", function () {
|
||||
signInWithRedirect(auth, provider);
|
||||
});
|
||||
|
||||
auth().onAuthStateChanged(function (user) {
|
||||
if (user) {
|
||||
// User is signed in.
|
||||
} else {
|
||||
// No user is signed in.
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
getRedirectResult(auth)
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<script src="firebaseLoader.js" type="module"></script>
|
||||
<script src="index.js" type="module" defer></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
16
admin/index.js
Normal file
16
admin/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { auth } from "./firebaseLoader.js";
|
||||
|
||||
// Check if google sign up button is pressed
|
||||
document.getElementById("googleSignButton").addEventListener("click", function () {
|
||||
signInWithRedirect(auth, provider);
|
||||
});
|
||||
|
||||
|
||||
|
||||
auth().onAuthStateChanged(function (user) {
|
||||
if (user) {
|
||||
window.location.href="ui/index.html";
|
||||
} else {
|
||||
// No user is signed in.
|
||||
}
|
||||
});
|
||||
@ -16,7 +16,7 @@
|
||||
<h3 id="signOutButton" class="roboto">Sign out</h3>
|
||||
</div>
|
||||
<div class="mainWrapper">
|
||||
<h1 class="roboto">Admin ui</h1>
|
||||
<h1 class="roboto">Cool ui</h1>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
.header {
|
||||
border-bottom: 1px solid #111;
|
||||
padding: 1.5rem 5vw;
|
||||
padding: 0.1rem 1vw;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mainWrapper {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.roboto {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user