Close popover
Mariane Ammar (MarianeA)

MarianeA Member since 2016 72 posts
Posted: March 13, 2017
Last activity: March 16, 2017

Retrieve value of captcha from the activity Code-Security.pyGenerateCaptcha


Currently in the activity Code-Security.pyGenerateCaptcha, RS: Pega-EndUserUI:07-10-01 we are generating a value for the CAPTCHA and storing it under the property pzCaptchaAnswer as follows:

Also, the HTML rule @baseclass.Web-Login, RS: Pega-EndUserUI:07-10-25 is calling the above activity
We added a function similar to the current function changeCaptcha() that retrieves the value of the captcha (stored under pzCaptchaAnswer) after generating a new one (PS: for now we are currently retrieving/displaying it only. Later on we need it because we are implementing a client-side captcha validation on a page different then the Login Page). Below is the function that is supposed to retrieve and display the catcha generated from the activity pyGenerateCaptcha

function changeCaptcha2() {
var capAnswer = "a";
var captchaSrc = "<%=captchaURL%>"+"&"+(new Date()).getTime();
document.getElementById("captchaDiv2").style.backgroundImage = "url('"+captchaSrc+"')";
<pega:when java='<%= tools.findPage("pxRequestor").getString("pzCaptchaAnswer ") != "aa"%>'>
capAnswer = '<%=tools.findPage("pxRequestor").getString("pzCaptchaAnswer ")%>';

We have traced the activity Code-Security.pyGenerateCaptcha and we have seen that the value of pzCaptchaAnswer is correct

However, the alert box that is supposed to display the value of pzCaptchaAnswer either returns an empty value or returns a different captcha code then the one displayed on the page. We cannot trace what happens in the @baseclass.Web-Login ! If we can, can you please indicate how ?

Is the context of pxRequestor changing?
Is there something we are missing that is preventing the retrieval of the value of pzCaptchaAnswer?

My main question is how can we retrieve/display the value of the captcha generated?

Any help or hint will be greatly appreciated :)

Thank you in advance,

***Updated by moderator: Lochan to add Categories***

Security System Administration User Experience
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.