-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.js
33 lines (29 loc) · 1.05 KB
/
login.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
angular.module('app')
.controller('LoginCtrl', function ($scope, $state, $auth) {
$scope.login = function () {
$scope.user.locationInfo = appSettings.locationInfo;
$auth.login($scope.user)
.then(function () {
//window.alert('You have successfully signed in!');
$state.go('main');
});
};
$scope.authenticate = function (provider) {
$auth.authenticate(provider)
.then(function () {
//window.alert('You have successfully signed in with ' + provider + '!');
$state.go('main');
});
};
if ($auth.isAuthenticated()) {
$state.go('main');
}
$scope.facebook = function(){
$auth.authenticate('facebook',{locationInfo:appSettings.locationInfo})
.then(function(res){
if(res){
$state.go('main');
}
});
};
});