2 * Copyright (c) 2014 Inocybe Technologies, and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 define(['common/login/login.module', 'common/authentification/auth.services'], function(login) {
11 login.controller('LoginCtrl', function ($scope, $http, $window, Auth, $location) {
14 $scope.login.username = "";
15 $scope.login.password = "";
16 $scope.login.remember = false;
17 $scope.rememberme = true;
19 $scope.sendLogin = function () {
20 Auth.login($scope.login.username, $scope.login.password, $scope.success, $scope.errorDisplay);
23 $scope.success = function(response) {
24 $window.location.href = 'index.html';
26 $scope.errorDisplay = function (error) {
27 $scope.error = "Unable to login";
32 login.controller('forgotPasswordCtrl', function ($scope, $http) {
34 $scope.recover.email = "";
35 $scope.sendForgotPassword = function () {
36 $http.post('/recover', $scope.recover).success(function (data) {
38 console.log("email sent");
41 console.log("email not sent");
48 login.controller('registerCtrl', function ($scope, $http) {
50 $scope.register.email = "";
51 $scope.register.username = "";
52 $scope.register.password = "";
53 $scope.register.repeatPassword = "";
54 $scope.register.userAgreement = false;
56 $scope.sendRegister = function () {
57 $http.post('/register', $scope.register).success(function (data) {
59 console.log("registration is successful");
62 console.log("registration failed");