X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Fdlux-web%2Fsrc%2Fcommon%2Flogin%2Flogin.controller.js;fp=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Fdlux-web%2Fsrc%2Fcommon%2Flogin%2Flogin.controller.js;h=750340d184b4faedb0b87a8e176837aa7238889a;hb=27fb2d06608fbb070ae2c15a5580a4f5b2423d15;hp=0000000000000000000000000000000000000000;hpb=60315525ab5e7c12a9f47c409092e8dba6ad656d;p=ccsdk%2Fapps.git diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/common/login/login.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/common/login/login.controller.js new file mode 100644 index 00000000..750340d1 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/common/login/login.controller.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014 Inocybe Technologies, and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['common/login/login.module', 'common/authentification/auth.services'], function(login) { + + login.controller('LoginCtrl', function ($scope, $http, $window, Auth, $location) { + // default values + $scope.login = {}; + $scope.login.username = ""; + $scope.login.password = ""; + $scope.login.remember = false; + $scope.rememberme = true; + + $scope.sendLogin = function () { + Auth.login($scope.login.username, $scope.login.password, $scope.success, $scope.errorDisplay); + }; + + $scope.success = function(response) { + $window.location.href = 'index.html'; + }; + $scope.errorDisplay = function (error) { + $scope.error = "Unable to login"; + + }; + }); + + login.controller('forgotPasswordCtrl', function ($scope, $http) { + $scope.recover = {}; + $scope.recover.email = ""; + $scope.sendForgotPassword = function () { + $http.post('/recover', $scope.recover).success(function (data) { + if (data.recover) { + console.log("email sent"); + } + else { + console.log("email not sent"); + } + }); + + }; + }); + + login.controller('registerCtrl', function ($scope, $http) { + $scope.register = {}; + $scope.register.email = ""; + $scope.register.username = ""; + $scope.register.password = ""; + $scope.register.repeatPassword = ""; + $scope.register.userAgreement = false; + + $scope.sendRegister = function () { + $http.post('/register', $scope.register).success(function (data) { + if (data.register) { + console.log("registration is successful"); + } + else { + console.log("registration failed"); + } + }); + }; + }); +});