Files
duplicati/Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js
T

22 lines
587 B
JavaScript
Raw Normal View History

2016-10-13 21:45:31 +02:00
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;
});