unserver-unify
Version:
64 lines • 2.94 kB
JavaScript
'use strict';
angular.module('bamboo').controller('LoginDlgCtrl', function($scope, $location, ApiService, $state, $localStorage,deviceDetector, $uibModal, loginService, $uibModalInstance) {
$scope.agreeFlag = true;
this.imageUrlPrefix = ApiService.SHOST + "/public/" + ApiService.RES + "/school/" + loginService.school._id + "/";
if (loginService.school.icon) {
this.logoUrl = this.imageUrlPrefix + loginService.school.icon;
} else {
this.logoUrl = ApiService.SHOST + "//public/resg/school/54321ef40f6006a95112893f/Logo.png";
}
$scope.login = {};
$scope.login.userType = "student";
console.log($state.current.name);
if ($state.current.name.indexOf('index.home') < 0) {
// $localStorage.thirdpartyPage=$location.url();
sessionStorage.thirdpartyPage = $location.url();
console.info($location.url());
} else {
sessionStorage.removeItem('thirdpartyPage');
delete $localStorage.thirdpartyPage;
}
this.submitForm = function(form, setting) {
console.log(setting);
setting = setting || {};
setting.forgotPassword = false;
setting.showagreement = false;
$scope.submitted = true;
if (form.$invalid) {
return;
} else {
$uibModalInstance.close(setting);
}
};
this.showagreement = function(setting) {
setting = setting || {};
setting.showagreement = true;
$uibModalInstance.close(setting);
};
this.showenviroment = function(setting) {
setting = setting || {};
setting.enviroment = true;
$uibModalInstance.close(setting);
};
this.forgotPassword = function(setting) {
setting = setting || {};
setting.forgotPassword = true;
$uibModalInstance.close(setting);
};
this.casLoginURL = ApiService.getFullUrl('/oauth/caslogin');
this.googleLoginURL = ApiService.getFullUrl('/oauth/google/' + loginService.school.key);
this.ubuntuLoginURL = ApiService.getFullUrl('/oauth/ubuntu');
// this.googleGSXLoginURL=ApiService.getFullUrl('/oauth/googlegsx');
this.linkedInLoginURL = ApiService.getFullUrl('/oauth/linkedin/'+loginService.school.key);
// this.linkedInGSXLoginURL = ApiService.getFullUrl('/oauth/linkedingsx');
this.facebookLoginURL = ApiService.getFullUrl('/oauth/facebook/' + loginService.school.key);
// this.facebookGSXLoginURL=ApiService.getFullUrl('/oauth/facebookgsx');
this.twitterLoginURL = ApiService.getFullUrl('/oauth/twitter/' + loginService.school.key);
this.WechatLoginURL = ApiService.getFullUrl('/oauth/wechat/' + loginService.school.key);
if (deviceDetector.isMobile() && !deviceDetector.isTablet()) {
this.WechatLoginURL = ApiService.getFullUrl('/oauth/wechat/' + loginService.school.key + 'mobile');
}
// this.twitterGSXLoginURL=ApiService.getFullUrl('/oauth/twittergsx');
this.caregiveLoginURL = ApiService.getFullUrl('/oauth/caregiveasia');
this.wsfedUrl = ApiService.getFullUrl('/oauth/wsfed');
});