|
'use strict';
/**
* @ngdoc function
* @name domainManagerApp.controller:MainCtrl
* @description
* # MainCtrl
* Controller of the domainManagerApp
*/
angular.module('domainManagerApp.signin', ['firebase'])
.controller('SignInController', ['$scope', '$firebaseAuth', function ($scope, $firebaseAuth) {
var firebaseObj = new Firebase("https://j1x-cpanel.firebaseio.com");
$scope.authObj = $firebaseAuth(firebaseObj);
$scope.SignIn = function(event) {
event.preventDefault(); // To prevent form refresh
var username = $scope.user.email;
var password = $scope.user.password;
$scope.authObj.$authWithPassword({
email: username,
password: password
}).then(function(authData) {
console.log("Logged in as:", authData.uid);
}).catch(function(error) {
console.error("Authentication failed:", error);
});
}
}]);
|