8000 Merge pull request #33 from LukeSchlangen/master · dendisuhubdy/quickstart-js@28c1e7a · GitHub
[go: up one dir, main page]

Skip to content

Commit 28c1e7a

Browse files
Merge pull request firebase#33 from LukeSchlangen/master
feat(log out): Adding log out button to database project
2 parents 94765eb + 757ba38 commit 28c1e7a

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

database/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ <h3 class="logo">Database Web Quickstart</h3>
7474

7575
<div class="mdl-layout__header-row titlebar">
7676
<h3 class="logo">Database Web Quickstart</h3>
77+
<button id="sign-out-button" class="mdl-button--raised mdl-button mdl-js-button mdl-js-ripple-effect"><i class="material-icons">account_circle</i> Sign out</button>
7778
</div>
7879

7980
<!-- Navigation Bar -->

database/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ h3 {
126126
margin-left: 10px;
127127
color: inherit;
128128
}
129+
#sign-out-button {
130+
margin: 10px;
131+
color: inherit;
132+
}
129133
.mdl-button .material-icons {
130134
margin-top: -2px;
131135
}

database/scripts/main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var messageForm = document.getElementById('message-form');
2020
var messageInput = document.getElementById('new-post-message');
2121
var titleInput = document.getElementById('new-post-title');
2222
var signInButton = document.getElementById('sign-in-button');
23+
var signOutButton = document.getElementById('sign-out-button');
2324
var splashPage = document.getElementById('page-splash');
2425
var addPost = document.getElementById('add-post');
2526
var addButton = document.getElementById('add');
@@ -292,6 +293,11 @@ window.addEventListener('load', function() {
292293
firebase.auth().signInWithPopup(provider);
293294
});
294295

296+
// Bind Sign out button.
297+
signOutButton.addEventListener('click', function() {
298+
firebase.auth().signOut();
299+
});
300+
295301
// Listen for auth state changes
296302
firebase.auth().onAuthStateChanged(function(user) {
297303
if (user) {

0 commit comments

Comments
 (0)
0