Files
duplicati/Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js
T
Kenneth SkovhedeandGitHub 17e2a3dab4 Feature/add delete dialog (#2008)
Added a delete page with options to delete the local database, as well as the remote files.
Added a captcha to protect against automated attacks that would attempt to delete the remote files.

This fixes #1201
2016-10-13 21:45:31 +02:00

22 lines
587 B
JavaScript

backupApp.controller('CaptchaController', function($scope, CaptchaService, DialogService, AppService, AppUtils) {
var entry = $scope.entry = CaptchaService.active;
function refreshImage() {
entry.imageurl = null;
AppService.post('/captcha', { 'target': entry.target}).then(function(resp) {
entry.token = resp.data.token;
entry.imageurl = AppService.apiurl + '/captcha/' + entry.token;
}, function(err) {
DialogService.dismissCurrent();
AppUtils.connectionError(err);
});
};
if (entry.token == null)
refreshImage();
$scope.reload = refreshImage;
});