1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 'use strict';
- * @ngdoc function
- * @name domainManagerApp.controller:MainCtrl
- * @description
- * # MainCtrl
- * Controller of the domainManagerApp
- */
- angular.module('domainManagerApp.signin', ['firebase', 'angular-ladda'])
- .controller('SignInController', ['$scope', '$firebaseAuth', '$timeout', function ($scope, $firebaseAuth, $timeout) {
- $scope.loading = false;
- var firebaseObj = new Firebase("https://j1x-cpanel.firebaseio.com");
- $scope.authObj = $firebaseAuth(firebaseObj);
- $scope.SignIn = function(event) {
- $scope.loading = true;
- event.preventDefault();
- 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);
- $timeout(function() {
- $scope.loading = false;
- }, 1000);
- }).catch(function(error) {
- console.error("Authentication failed:", error);
- $timeout(function() {
- $scope.loading = false;
- }, 1000);
- });
- }
- }]);
|