Created
August 6, 2013 16:24
-
-
Save rubyonrailstutor/6166069 to your computer and use it in GitHub Desktop.
user auth
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
.factory("Session", () -> | |
Session = | |
user: "john" | |
show_user: () -> | |
console.log @new_auth.user | |
connection: new Firebase("https://pitchclub.firebaseIO.com/rooms") | |
new_auth: {} | |
login: () -> | |
firebase = new Firebase("https://pitchclub.firebaseIO.com/rooms") | |
return_user = {} | |
@new_auth = new FirebaseSimpleLogin(@connection, (error, user) -> | |
if error | |
console.log "error detected" | |
else if user | |
console.log user | |
else if ! user && ! error | |
console.log "logout successful" | |
) | |
@new_auth.login("facebook") | |
logout: () -> | |
@new_auth.logout() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment