diff options
Diffstat (limited to 'Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js')
-rw-r--r-- | Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js b/Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js new file mode 100644 index 000000000..2238e66ff --- /dev/null +++ b/Duplicati/Server/webroot/ngax/scripts/controllers/CaptchaController.js @@ -0,0 +1,21 @@ +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; +}); |