You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
923 B

'use strict';
angular
.module('sloDialectsAdmin')
.component('password', {
templateUrl: 'components/password/password.template.html',
controller: ['$http', '$location', '$timeout', function PasswordController($http, $location, $timeout) {
var vm = this;
vm.go = go;
vm.username = "";
vm.changePassword = function(){
vm.error = "";
// TODO
$http.put('../api/changePassword', {old_password: vm.old_password, new_password: vm.new_password, new_password_repeat: vm.new_password_repeat}).then(function (result) {
if(result.data.success){
vm.success = result.data.message;
$timeout(function(){
go('/login');
}, 3000);
} else {
vm.error = result.data.message;
}
}, function (error, x) {
vm.error = "Prišlo je do napake pri zahtevi za menjavo gesla.";
});
}
function go(path) {
$location.path(path);
}
}]
});