2014-01-27 12:50:13 -05:00
|
|
|
define(function(require) {
|
|
|
|
'use strict';
|
|
|
|
|
2014-07-01 13:49:19 -04:00
|
|
|
var appCtrl = require('js/app-controller');
|
2014-01-27 12:50:13 -05:00
|
|
|
|
|
|
|
var AddAccountCtrl = function($scope, $location) {
|
|
|
|
$scope.connectToGoogle = function() {
|
2014-07-01 13:49:19 -04:00
|
|
|
// test for oauth support
|
|
|
|
if (appCtrl._auth._oauth.isSupported()) {
|
|
|
|
// fetches the email address from the chrome identity api
|
|
|
|
appCtrl._auth.getOAuthToken(function(err) {
|
|
|
|
if (err) {
|
|
|
|
return $scope.onError(err);
|
|
|
|
}
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'gmail'
|
|
|
|
});
|
|
|
|
$scope.$apply();
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
2014-01-27 12:50:13 -05:00
|
|
|
|
2014-07-01 13:49:19 -04:00
|
|
|
// use normal user/password login
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'gmail'
|
2014-01-27 12:50:13 -05:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-07-01 13:49:19 -04:00
|
|
|
$scope.connectToYahoo = function() {
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'yahoo'
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.connectToTonline = function() {
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'tonline'
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-09-05 13:02:02 -04:00
|
|
|
$scope.connectToOutlook = function() {
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'outlook'
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-09-05 13:51:36 -04:00
|
|
|
$scope.connectToGmx = function() {
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'gmx'
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-09-08 12:12:04 -04:00
|
|
|
$scope.connectToWebde = function() {
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'webde'
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-07-01 13:49:19 -04:00
|
|
|
$scope.connectOther = function() {
|
|
|
|
$location.path('/login-set-credentials').search({
|
|
|
|
provider: 'custom'
|
|
|
|
});
|
|
|
|
};
|
2014-01-27 12:50:13 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
return AddAccountCtrl;
|
|
|
|
});
|