Created
May 29, 2023 07:44
-
-
Save ankur0101/8b839d3d636e66c54768a3b4d37179e9 to your computer and use it in GitHub Desktop.
SAPUI5 custom control for Google reCaptcha V2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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