Append renew captcha button (#2019)
parent
6c890ecf30
commit
a3a800108c
@ -0,0 +1,26 @@ |
||||
# Launch renew captcha request |
||||
|
||||
renewCaptcha = () -> |
||||
console.log 'Call URL -> ', "#{portal}renewcaptcha" |
||||
# Request to get new token and image |
||||
$.ajax |
||||
type: "GET" |
||||
url: "#{portal}renewcaptcha" |
||||
dataType: 'json' |
||||
error: (j, status, err) -> |
||||
console.log 'Error', err |
||||
res = JSON.parse j.responseText |
||||
if res and res.error |
||||
console.log 'Returned error', res |
||||
# On success, values are set |
||||
success: (data) -> |
||||
newtoken = data.newtoken |
||||
console.log 'GET new token -> ', newtoken |
||||
newimage = data.newimage |
||||
console.log 'GET new image -> ', newimage |
||||
$('#token').attr 'value', newtoken |
||||
$('#captcha').attr 'src', newimage |
||||
|
||||
$(document).ready -> |
||||
$('#logout').attr 'href', portal |
||||
$('.renewcaptchaclick').on 'click', renewCaptcha |
@ -0,0 +1,36 @@ |
||||
// Generated by CoffeeScript 1.12.7
|
||||
(function() { |
||||
var renewCaptcha; |
||||
|
||||
renewCaptcha = function() { |
||||
console.log('Call URL -> ', portal + "renewcaptcha"); |
||||
return $.ajax({ |
||||
type: "GET", |
||||
url: portal + "renewcaptcha", |
||||
dataType: 'json', |
||||
error: function(j, status, err) { |
||||
var res; |
||||
console.log('Error', err); |
||||
res = JSON.parse(j.responseText); |
||||
if (res && res.error) { |
||||
return console.log('Returned error', res); |
||||
} |
||||
}, |
||||
success: function(data) { |
||||
var newimage, newtoken; |
||||
newtoken = data.newtoken; |
||||
console.log('GET new token -> ', newtoken); |
||||
newimage = data.newimage; |
||||
console.log('GET new image -> ', newimage); |
||||
$('#token').attr('value', newtoken); |
||||
return $('#captcha').attr('src', newimage); |
||||
} |
||||
}); |
||||
}; |
||||
|
||||
$(document).ready(function() { |
||||
$('#logout').attr('href', portal); |
||||
return $('.renewcaptchaclick').on('click', renewCaptcha); |
||||
}); |
||||
|
||||
}).call(this); |
@ -0,0 +1 @@ |
||||
(function(){var e;e=function(){return console.log("Call URL -> ",portal+"renewcaptcha"),$.ajax({type:"GET",url:portal+"renewcaptcha",dataType:"json",error:function(e,r,o){var n;if(console.log("Error",o),(n=JSON.parse(e.responseText))&&n.error)return console.log("Returned error",n)},success:function(e){var r,o;return o=e.newtoken,console.log("GET new token -> ",o),r=e.newimage,console.log("GET new image -> ",r),$("#token").attr("value",o),$("#captcha").attr("src",r)}})},$(document).ready(function(){return $("#logout").attr("href",portal),$(".renewcaptchaclick").on("click",e)})}).call(this); |
@ -0,0 +1 @@ |
||||
{"version":3,"sources":["lemonldap-ng-portal/site/htdocs/static/common/js/captcha.js"],"names":["renewCaptcha","console","log","portal","$","ajax","type","url","dataType","error","j","status","err","res","JSON","parse","responseText","success","data","newimage","newtoken","attr","document","ready","on","call","this"],"mappings":"CACA,WACE,IAAIA,EAEJA,EAAe,WAEb,OADAC,QAAQC,IAAI,eAAgBC,OAAS,gBAC9BC,EAAEC,KAAK,CACZC,KAAM,MACNC,IAAKJ,OAAS,eACdK,SAAU,OACVC,MAAO,SAASC,EAAGC,EAAQC,GACzB,IAAIC,EAGJ,GAFAZ,QAAQC,IAAI,QAASU,IACrBC,EAAMC,KAAKC,MAAML,EAAEM,gBACRH,EAAIJ,MACb,OAAOR,QAAQC,IAAI,iBAAkBW,IAGzCI,QAAS,SAASC,GAChB,IAAIC,EAAUC,EAMd,OALAA,EAAWF,EAAKE,SAChBnB,QAAQC,IAAI,oBAAqBkB,GACjCD,EAAWD,EAAKC,SAChBlB,QAAQC,IAAI,oBAAqBiB,GACjCf,EAAE,UAAUiB,KAAK,QAASD,GACnBhB,EAAE,YAAYiB,KAAK,MAAOF,OAKvCf,EAAEkB,UAAUC,MAAM,WAEhB,OADAnB,EAAE,WAAWiB,KAAK,OAAQlB,QACnBC,EAAE,sBAAsBoB,GAAG,QAASxB,OAG5CyB,KAAKC"} |
Loading…
Reference in new issue