Skip to content

Angular module for authentication with the Firebase email & password authentication service.

Notifications You must be signed in to change notification settings

fortesl/lf-firebase-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An angular module for user authentication to the Firebase email & password authentication service.

Angular module name: lfFirebaseAuth

Name of service: lfFirebaseAuthService

Important: Calling module must declare a constant string named FIREBASE_URL containing the url of a firebase database.

Methods available on the lfFirebaseAuthService:

  • add - creates a new user
  • authServiceError - returns an object with details of the last error occurred
  • changePassword - changes a user password
  • isLoggedIn - returns true if user is logged in, returns false otherwise
  • isTemporaryPassword - returns true if user logged in with a temporary password. returns false otherwise
  • login - signs in an existing user
  • logout - logs out current user
  • resetPassword - Creates a temporary password and generates email to user for resetting current password
  • user - returns an object containing user properties
  • Usage example

    First include the javascript file in your html document:

    <script src="./lf-firebase-auth/lf-firebase-auth-service.js"></script>

    Then use in your own javascript file. Example shown below:

    var myApp = angular.module('myApp', ['lfFirebaseAuth']);
    myApp.constant('FIREBASE_URL',  'https://mydb.firebaseio.com');  // Needed by the auth service!!!
    
    myApp.controller('MyController', ['lfFirebaseAuthService', function(lfFirebaseAuthService) {
       var self = this;
    
        self.createUser = function() {
            lfFirebaseAuthService.add({email:'[email protected]', password:'12345678', name: 'john doe'}, true).then(function(){
                    self.userServiceError = {};
                    $location.path('/#/');
                }, function(error) {
                    self.userServiceError = error;
                });
        };
    
    });
    

About

Angular module for authentication with the Firebase email & password authentication service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published