2016-08-14 13:37:26 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('warehost')
|
2016-08-17 22:35:25 +02:00
|
|
|
.controller('SettingsCtrl',function(session,config,alert,$scope,$http){
|
2016-08-14 13:37:26 +02:00
|
|
|
$scope.obj = {};
|
2016-08-17 22:35:25 +02:00
|
|
|
alert.set({});
|
2016-08-14 13:37:26 +02:00
|
|
|
$scope.submit = function(){
|
2016-08-17 22:35:25 +02:00
|
|
|
if($scope.obj.newPassword === $scope.obj.repeatPassword){
|
|
|
|
$http.post(config.api+'/password',$scope.obj).then(function(res){
|
|
|
|
session.set(res);
|
|
|
|
alert.set(res);
|
|
|
|
$scope.obj = {};
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
alert.set({msg:'Not equal Passwords'});
|
|
|
|
}
|
2016-08-14 13:37:26 +02:00
|
|
|
};
|
|
|
|
$scope.delete = function(){
|
2016-08-14 14:22:11 +02:00
|
|
|
if(window.confirm('realy delete your login and everything else on warehost?')){
|
2016-08-14 13:37:26 +02:00
|
|
|
$http.get(config.api+'/delete').then(function(res){
|
|
|
|
session.set(res);
|
2016-08-17 22:35:25 +02:00
|
|
|
alert.set(res);
|
2016-08-14 13:37:26 +02:00
|
|
|
});
|
2016-08-17 22:35:25 +02:00
|
|
|
}else{
|
|
|
|
alert.set({msg:'Account not deleted'});
|
2016-08-14 13:37:26 +02:00
|
|
|
}
|
2016-08-14 14:22:11 +02:00
|
|
|
};
|
2016-08-14 13:37:26 +02:00
|
|
|
});
|