Skip to content

Commit

Permalink
Merge pull request #380 from sunbird-cb/recaptcha-integration
Browse files Browse the repository at this point in the history
Recaptcha integration
  • Loading branch information
sivaprakash123 authored Aug 13, 2024
2 parents 9a218c2 + 5a92450 commit 31b7831
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions ansible/artifacts/sunbird/login/login.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
</div>
<div id="usePasswordDiv" class="mw-100" >
<form id="kc-form-login" onsubmit="encryptPassword(); return validateRecaptcha(); login.disabled = true; return true;" class="ui form" method="POST" action="${url.loginAction}">
<form id="kc-form-login" onsubmit="return validateRecaptcha(); login.disabled = true; return true;" class="ui form" method="POST" action="${url.loginAction}">
<input type="hidden" id="ivField" name="iv" />
<input type="hidden" name="page_type" value="login_with_pass" />
<div class="field">
Expand Down Expand Up @@ -256,22 +256,7 @@
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.js"></script>
<script type="text/javascript">
function encryptPassword() {
var secretKey = CryptoJS.enc.Utf8.parse("${secretKey}");
var passwordField = document.getElementById("password");
var iv = CryptoJS.lib.WordArray.random(16);
var encrypted = CryptoJS.AES.encrypt(passwordField.value, secretKey, {
iv: iv,
padding: CryptoJS.pad.Pkcs7,
mode: CryptoJS.mode.CBC
}).toString();
document.getElementById('ivField').value = CryptoJS.enc.Base64.stringify(iv);
passwordField.value = encrypted;
}
</script>

<script type="text/javascript">
callZohoForm()
Expand Down

0 comments on commit 31b7831

Please sign in to comment.