2016-05-06 14:37:44 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('harbor.layout.sign.up')
|
|
|
|
.controller('SignUpController', SignUpController);
|
2016-05-09 12:53:40 +02:00
|
|
|
|
|
|
|
SignUpController.$inject = ['SignUpService', '$window'];
|
2016-05-06 14:37:44 +02:00
|
|
|
|
2016-05-09 12:53:40 +02:00
|
|
|
function SignUpController(SignUpService, $window) {
|
|
|
|
var vm = this;
|
|
|
|
|
|
|
|
vm.user = {};
|
|
|
|
vm.signUp = signUp;
|
|
|
|
|
|
|
|
function signUp(user) {
|
|
|
|
var userObject = {
|
|
|
|
'username': user.username,
|
|
|
|
'email': user.email,
|
|
|
|
'password': user.password,
|
|
|
|
'realname': user.fullName,
|
|
|
|
'comment': user.comments
|
2016-05-06 14:37:44 +02:00
|
|
|
};
|
2016-05-09 12:53:40 +02:00
|
|
|
SignUpService(userObject)
|
|
|
|
.success(signUpSuccess)
|
|
|
|
.error(signUpFailed);
|
2016-05-06 14:37:44 +02:00
|
|
|
}
|
2016-05-09 12:53:40 +02:00
|
|
|
|
|
|
|
function signUpSuccess(data, status) {
|
|
|
|
console.log('Signed up successfully:' + status);
|
|
|
|
alert('Signed up successfully');
|
|
|
|
$window.location.href = '/ng';
|
2016-05-06 14:37:44 +02:00
|
|
|
}
|
|
|
|
|
2016-05-09 12:53:40 +02:00
|
|
|
function signUpFailed(data, status) {
|
|
|
|
console.log('Signed up failed.');
|
2016-05-06 14:37:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|