-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from whos-evan/login
Login feature, rest of the features still need to be added.
- Loading branch information
Showing
7 changed files
with
114 additions
and
142 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
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
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,21 @@ | ||
import firebase from "firebase/compat/app"; | ||
import "firebase/compat/auth"; | ||
import "firebase/compat/firestore"; | ||
import { initializeApp } from "firebase/app"; | ||
|
||
const firebaseConfig = { | ||
apiKey: "AIzaSyDdeaj5DFXkKDJOjFsCFkbwXFq_06njxbo", | ||
authDomain: "mystical-being-372905.firebaseapp.com", | ||
projectId: "mystical-being-372905", | ||
storageBucket: "mystical-being-372905.appspot.com", | ||
messagingSenderId: "208620925125", | ||
appId: "1:208620925125:web:38cf525729d9df823480ac", | ||
measurementId: "G-KS0SQ3ZEY8" | ||
}; | ||
|
||
// Initialize Firebase | ||
firebase.initializeApp(firebaseConfig); | ||
|
||
export const auth = firebase.auth(); | ||
export const googleProvider = new firebase.auth.GoogleAuthProvider(); | ||
export const db = firebase.firestore(); |
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,35 @@ | ||
<script> | ||
import { auth, googleProvider } from '../../firebase'; | ||
import { authState } from 'rxfire/auth'; | ||
let user; | ||
const unsubscribe = authState(auth).subscribe((usr) => (user = usr)); | ||
function login() { | ||
auth.signInWithPopup(googleProvider); | ||
} | ||
function logout() { | ||
auth.signOut(); | ||
} | ||
import Nav from '../../components/nav.svelte'; | ||
import Footer from '../../components/footer.svelte'; | ||
</script> | ||
|
||
<Nav /> | ||
<div class="text-white h-[80vh] w-full text-center"> | ||
<h1 class="font-bold text-5xl">Login</h1> | ||
<p class="text-lg mb-5">Login with Google to get access to more features in the future.</p> | ||
{#if user} | ||
Logged in as {user.email} | ||
<br> | ||
<button on:click={logout} class="px-4 py-2 bg-white text-secondary font-bold">Logout</button> | ||
{:else} | ||
<button on:click={login}> | ||
<img src="/assets/google-signin.png" alt="signin"> | ||
</button> | ||
{/if} | ||
</div> | ||
<Footer /> |
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,36 @@ | ||
<script> | ||
import { auth, googleProvider } from '../../../firebase'; | ||
import { authState } from 'rxfire/auth'; | ||
let user; | ||
const unsubscribe = authState(auth).subscribe((usr) => (user = usr)); | ||
function login() { | ||
auth.signInWithPopup(googleProvider); | ||
} | ||
function logout() { | ||
auth.signOut(); | ||
} | ||
import Nav from '../../../components/nav.svelte'; | ||
import Footer from '../../../components/footer.svelte'; | ||
</script> | ||
|
||
<Nav /> | ||
<div class="text-white h-[80vh] w-full text-center"> | ||
<h1 class="font-bold text-5xl">Profile Settings (Coming soon)</h1> | ||
|
||
{#if user} | ||
Logged in as {user.email} | ||
<br /> | ||
<button on:click={logout} class="px-4 py-2 bg-white text-secondary font-bold">Logout</button> | ||
{:else} | ||
<br /> | ||
<button on:click={login}> | ||
<img src="/assets/google-signin.png" alt="signin" /> | ||
</button> | ||
{/if} | ||
</div> | ||
<Footer /> |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.