Skip to content

Instantly share code, notes, and snippets.

@ankur0101
Created May 29, 2023 07:44
Show Gist options
  • Save ankur0101/8b839d3d636e66c54768a3b4d37179e9 to your computer and use it in GitHub Desktop.
Save ankur0101/8b839d3d636e66c54768a3b4d37179e9 to your computer and use it in GitHub Desktop.
SAPUI5 custom control for Google reCaptcha V2
sap.ui.define([
'sap/ui/core/Control'
], function(Control, ) {
'use strict';
return Control.extend("enkompass.control.grecaptchav2", {
metadata : {
properties: {
key: {type: "string", defaultValue : 0},
size: {type: "string", defaultValue : "normal"}
}
},
init : function () {
jQuery.sap.includeScript('https://www.google.com/recaptcha/api.js')
},
renderer : function (oRm, oControl) {
oRm.openStart("div", oControl);
oRm.writeAttribute('data-sitekey', oControl.getProperty('key'));
oRm.writeAttribute('data-size', oControl.getProperty('size'));
oRm.class("g-recaptcha");
oRm.openEnd();
},
onAfterRendering: function(oEvent) {
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment