var app=angular.module("Login",[]);app.config(function($locationProvider,$httpProvider){$locationProvider.html5Mode(!0),$httpProvider.defaults.withCredentials=!0}).run(function($controller,$rootScope,$location,$http){$http({url:"/api/solutions/current"}).then(function(res){$rootScope.theme=res.data&&res.data.theme?res.data.theme:"iotfactory",$rootScope.register=!(!res.data||null==res.data.register)&&res.data.register},function(){$rootScope.theme="iotfactory",$rootScope.register=!1}),$rootScope.checkResetPassAccess=function(path){var token,pathTab=$location.url().split("/"),appPath=pathTab[1].split("?")[0];"resetpassword"!=appPath&&"invitation"!=appPath||1()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.login.email)&&($scope.emailValid=!0)}}}),app.component("appRegister",{templateUrl:"login/register.pug",controller:function($element,$window,$location,$scope,$http,$controller){console.log("register controller loaded"),$scope.register={email:"",language:"en",firstName:"",lastName:"",phone:"0000000000",company:"",name:"",solutionID:$location.host(),theme:"defaultSolutionTheme",accountLevel:"Free",maxUsers:5,status:"active",trial:0==$location.url().split("/")[1].indexOf("register-trial")},$scope.failed=!1,$scope.emailValid=!0,$scope.failedMsg="",$scope.registerFn=function(){$scope.register.name=$scope.register.company,console.log("sending register request"),$http.post("/api/users",$scope.register).then(function(response){console.log(response),$scope.failed=!0,$scope.failedMsg="Authentification success, an email has been sent to your email address.",$scope.changePage("/")},function(response){switch(response.status){case 406:console.info(response.data.message),$scope.failedMsg=response.data.message;break;default:console.info(response.status),$scope.failedMsg=response.status}console.log(response),$scope.failed=!0})},$scope.changePage=function(page){var lang=$location.search().lang;angular.isDefined(lang)&&-1==page.indexOf("?lang")&&-1==page.indexOf("&lang")&&(page+=(-1()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.register.email)&&($scope.emailValid=!0)}}}),app.component("appLostpassword",{templateUrl:"manage-password/lostpassword.pug",controller:function($element,$window,$location,$scope,$http,$controller){console.log("lostpassword controller loaded"),$scope.lostpassword={email:""},$scope.failed=!1,$scope.failedMsg="",$scope.emailValid=!0,$scope.changePage=function(page){var lang=$location.search().lang;angular.isDefined(lang)&&-1==page.indexOf("?lang")&&-1==page.indexOf("&lang")&&(page+=(-1()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.lostpassword.email)&&($scope.emailValid=!0)}}}),app.component("appResetpassword",{templateUrl:"manage-password/resetpassword.pug",controller:function($element,$window,$location,$scope,$http,$controller,$filter){console.log("resetpassword controller loaded"),$scope.resetpassword={password1:"",password2:""},$scope.failed=!1,$scope.failedMsg="",$scope.passwordValid=!0,$scope.email=$location.url().split("/")[2].split("?")[0],$scope.token=$location.url().split("/")[2].split("?")[1],$location.search().hasOwnProperty("lang")&&($scope.token=$scope.token.split("&lang")[0]),console.log("location",$location),console.log("scope email",$scope.email),console.log("token",$scope.token),$scope.changePage=function(page){var lang=$location.search().lang;angular.isDefined(lang)&&-1==page.indexOf("?lang")&&-1==page.indexOf("&lang")&&(page+=(-1