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

24 lines
705 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 refreshChallenge() {
2016-10-13 21:45:31 +02:00
entry.imageurl = null;
2024-06-07 15:56:43 +02:00
AppService.postJson('/captcha', { 'target': entry.target}).then(function(resp) {
entry.token = resp.data.Token;
entry.expectedAnswer = resp.data.Answer;
entry.noVisualChallenge = resp.data.NoVisualChallenge;
2016-10-13 21:45:31 +02:00
entry.imageurl = AppService.apiurl + '/captcha/' + entry.token;
}, function(err) {
DialogService.dismissCurrent();
AppUtils.connectionError(err);
});
};
if (entry.token == null)
refreshChallenge();
2016-10-13 21:45:31 +02:00
$scope.reload = refreshChallenge;
2016-10-13 21:45:31 +02:00
});