Skip to content

Instantly share code, notes, and snippets.

@NFodrea
Created April 25, 2017 22:42
Show Gist options
  • Select an option

  • Save NFodrea/20a1ac6bd0200de09595fbccd6324d50 to your computer and use it in GitHub Desktop.

Select an option

Save NFodrea/20a1ac6bd0200de09595fbccd6324d50 to your computer and use it in GitHub Desktop.
Firebase Authentication helpers (change workout app to current app name/firebase collection)
export class AuthData {
fireAuth: any;
constructor(public af: AngularFire) {
af.auth.subscribe( user => {
if (user) { this.fireAuth = user.auth; }
});
}
loginUser(newEmail: string, newPassword: string): any {
return this.af.auth.login({
email: newEmail,
password: newPassword
});
}
getUser(){
return this.fireAuth;
}
resetPassword(email: string): any {
return firebase.auth().sendPasswordResetEmail(email);
}
logoutUser(): any {
return this.af.auth.logout();
}
signupUser(newEmail: string, newPassword: string): any {
return this.af.auth.createUser({
email: newEmail,
password: newPassword
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment