Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recaptcha integration #380

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading