Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
Added Google Auth
Browse files Browse the repository at this point in the history
  • Loading branch information
daffadevhosting committed Feb 23, 2023
1 parent a6b8455 commit 5fbed77
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 1,035 deletions.
13 changes: 10 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
WA_KEY="081386267897"
SITE_KEY="6LdPL-wZAAAAAAzUvjEWXHGLAgKL78wBzB1IR8t7"

WA_KEY=081386267897
SITE_KEY=6LdPL-wZAAAAAAzUvjEWXHGLAgKL78wBzB1IR8t7
API_KEY=AIzaSyCh346K5NgNSvVq6Mv817GH_E6cPDurR2s
AUTH_DOMAIN=plus62bordir.firebaseapp.com
DATABASE_URL=https://plus62bordir-default-rtdb.asia-southeast1.firebasedatabase.app
PROJECT_ID=plus62bordir
STORAGE_BUCKET=plus62bordir.appspot.com
SENDER_ID=787412546935
APP_ID=1:787412546935:web:919338bbff32eada8cdd72
MEASUREMENT_ID=G-C082YPREP9
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
_site
_styles
.DS_Store
.jekyll
.bundle
.env
.sass-cache
gulpfile.js
Gemfile
Gemfile.lock
node_modules
package.json
package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
I":<style>
I"]<style>
:root {
--ion-safe-area-top: 20px;
--ion-safe-area-bottom: 22px;
Expand Down Expand Up @@ -96,13 +96,6 @@ animation-iteration-count: infinite;
.preloader{display:none!important}
</style>

<script>
function pageRedirect() {
window.location.replace("/product");
}
setTimeout("pageRedirect()", 80000);
</script>

<p>&lt;/head&gt;</p>
<body>
<ion-app>
Expand Down Expand Up @@ -140,10 +133,45 @@ animation-iteration-count: infinite;
</ion-slide>

<ion-slide>
<img src="assets/images/logo/olshop.webp" />
<h2>Siap Berbelanja?</h2>
<div class="index_devider"></div>
<ion-button fill="clear" onclick="myProduct()" style="margin-top:20px;">Go Shopping <ion-icon slot="end" name="cart"></ion-icon></ion-button>
<img src="https://img.freepik.com/free-icon/google_318-278809.jpg" />
<h2>Sign In dengan Google</h2>
<p>Untuk melanjutkan silahkan sign in dengan google anda.</p>
<ion-button id="sign-in-button" color="primary" style="margin-top:10px;"><ion-icon slot="start" name="logo-google"></ion-icon> Sign In</ion-button>

<script type="module">
const firebaseConfig = {
apiKey: "{{ site.env.API_KEY }}",
authDomain: "{{ site.env.AUTH_DOMAIN }}",
databaseURL: "{{ site.env.DATABASE_URL }}",
projectId: "{{ site.env.PROJECT_ID }}",
storageBucket: "{{ site.env.STORAGE_BUCKET }}",
messagingSenderId: "{{ site.env.SENDER_ID }}",
appId: "{{ site.env.APP_ID }}",
measurementId: "{{ site.env.MEASUREMENT_ID }}"
};
firebase.initializeApp(firebaseConfig);

const auth = firebase.auth();

const userSignedInDiv = document.getElementById('user-signed-in');
const signInButton = document.getElementById('sign-in-button');

function toggleUI() {
if (auth.currentUser) {
location.href = "{{site.baseurl}}/product";
} else {
}
}

signInButton.addEventListener('click', () => {
const provider = new firebase.auth.GoogleAuthProvider();
auth.signInWithPopup(provider);
});

auth.onAuthStateChanged(user => {
toggleUI();
});
</script>
</ion-slide>
</ion-slides>
</ion-content>
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Static web shopping form order whatsapp with google authentication,

base on jekyllv.4.2 and ionic framework v.6

site : [https://plus62store.my.id](https://plus62store.my.id)
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ compress_html:
ignore:
envs: development

exclude: [lib, config.rb, .sass-cache, Capfile, config, log, Rakefile, Rakefile.rb, tmp, Gemfile, Gemfile.lock, README.md, LICENSE.md, node_modules, gulpfile.js, package.json, package-lock.json]
exclude: [lib, config.rb, .sass-cache, .env, Capfile, config, log, Rakefile, Rakefile.rb, tmp, Gemfile, Gemfile.lock, README.md, LICENSE.md, node_modules, gulpfile.js, package.json, package-lock.json]
12 changes: 8 additions & 4 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light darkmode" />
<meta name="google-site-verification" content="{{site.G-verify}}" />
<script defer src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>

<script defer src="https://www.gstatic.com/firebasejs/8.10.1/firebase-auth.js"></script>
<script defer src="https://www.gstatic.com/firebasejs/8.10.1/firebase-firestore.js"></script>
<meta name="yandex-verification" content="42c9b7a5a8c7355c" />
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
Expand Down Expand Up @@ -38,8 +42,8 @@
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}" />
<meta name="twitter:description" content="{% if pagecontent_description.size > 10 %}{{ page.description }}{% else %}{{ site.description }}{% endif %}" />
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
<link rel="sitemap" type="application/xml" title="Sitemap" href="{{ "/sitemap.xml" | prepend: site.baseurl | prepend: site.url }}" />
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ '/feed.xml' | prepend: site.baseurl | prepend: site.url }}">
<link rel="sitemap" type="application/xml" title="Sitemap" href="{{ '/sitemap.xml' | prepend: site.baseurl | prepend: site.url }}" />
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
Expand Down Expand Up @@ -267,6 +271,6 @@
</head>
<body>
{% include preload.html %}
<ion-app>
{% include ion-header.html %}
<ion-app> {% if page.url == "{{site.baseurl}}/" %}{% elsif page.url contains '/product/' or page.layout == 'default' %}
{% include ion-header.html %}{% elsif page.layout == 'webshop' or page.layout == 'checkout-page' %}{% include ion-header.html %}{% endif %}
<ion-content fullscreen>
2 changes: 1 addition & 1 deletion _includes/ion-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

async function handleButtonClick() {
const alert = await alertController.create({
message: '<h4><center><ion-icon name="git-network" slot="start"></ion-icon> <ion-label>Fork This at <a href="/daffadevhosting/ionic-jekyll">GitHub</ion-label> <ion-icon name="logo-github" slot="end"></ion-icon></a><p /><br /><ion-note>Developed by NdanG</ion-note></center></h4>',
message: '<h4><center><ion-note>Hallo <span id="user-display-name"></span></ion-note><p /><br /><ion-icon name="git-network" slot="start"></ion-icon> <ion-label>Fork This at <a href="/daffadevhosting/ionic-jekyll">GitHub</ion-label> <ion-icon name="logo-github" slot="end"></ion-icon></a></center></h4>',
buttons: ['Nanti Saja'],
});

Expand Down
41 changes: 41 additions & 0 deletions _includes/ion-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<ion-button onclick="myProduct()"><ion-icon slot="icon-only" name="arrow-back-outline"></ion-icon></ion-button>
</ion-buttons>
{% endif %}
<ion-buttons slot="end">
<ion-button id="sign-out-button"><ion-icon slot="icon-only" name="log-out-outline"></ion-icon></ion-button>
</ion-buttons>
<ion-chip slot="end" onclick="setDarkMode(true)" id="darkBtn">
<div>
<ion-label style="display: none;">DarkMode</ion-label>
Expand All @@ -82,3 +85,41 @@
</ion-chip>
</ion-toolbar>
</ion-header>

<script type="module">
const firebaseConfig = {
apiKey: "{{ site.env.API_KEY }}",
authDomain: "{{ site.env.AUTH_DOMAIN }}",
databaseURL: "{{ site.env.DATABASE_URL }}",
projectId: "{{ site.env.PROJECT_ID }}",
storageBucket: "{{ site.env.STORAGE_BUCKET }}",
messagingSenderId: "{{ site.env.SENDER_ID }}",
appId: "{{ site.env.APP_ID }}",
measurementId: "{{ site.env.MEASUREMENT_ID }}"
};
firebase.initializeApp(firebaseConfig);

const auth = firebase.auth();

const userSignedOutDiv = document.getElementById('user-signed-out');
const userSignedInDiv = document.getElementById('user-signed-in');
const userDisplayName = document.getElementById('user-display-name');
const userEmail = document.getElementById('user-email');
const signOutButton = document.getElementById('sign-out-button');

function toggleUI() {
if (auth.currentUser) {
userDisplayName.textContent = auth.currentUser.displayName;
userEmail.textContent = auth.currentUser.email;
} else {
location.href = "{{site.baseurl}}/";
}
}
signOutButton.addEventListener('click', () => {
auth.signOut();
});

auth.onAuthStateChanged(user => {
toggleUI();
});
</script>
1 change: 1 addition & 0 deletions _layouts/checkout-page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: default
---

<style>
.keranjang-box .simpleCart_increment, .keranjang-box .simpleCart_decrement, .keranjang-box .item-remove, .simpleCart_items .item-remove, .keranjang-box .item-link {display:none !important;}.keranjang-box .item-quantity {padding: 0 !important;}
</style>
Expand Down
4 changes: 2 additions & 2 deletions _layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
layout: compress
---
<!DOCTYPE html>
<html lang="en">
{% include head.html %}
<html lang="id">
{% include head.html %}


{{ content }}
Expand Down
84 changes: 0 additions & 84 deletions _sass/_highlights.scss

This file was deleted.

53 changes: 0 additions & 53 deletions _sass/_reset.scss

This file was deleted.

Loading

0 comments on commit 5fbed77

Please sign in to comment.