google-recaptcha.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['g-recaptcha'],
attributeBindings: ['data-sitekey'],
'data-sitekey': '6LcggAqwgTAAA234AAO5J44Z422341rdG1d4qQ234sasfasqDD-iYmVT5p5gv',
didInsertElement: function() {
var self = this;
grecaptcha.render(self.$().prop('departments'), {
'sitekey': self.get('data-sitekey')
});
}
});
google-recaptcha.hbs
<div id="departments"></div>
{{yield}}
Then I just placed it in the form to give me an HTML structure like this:
<div data-sitekey="6LcggAqwgTAAA234AAO5J44Z422341rdG1d4qQ234sasfasqDD-iYmVT5p5gv" class="ember-view g-recaptcha" id="ember705"><div id="departments"></div>
<!---->
</div>
Unfortunately, this renders absolutely nothing. Instead of dynamically loading the script I installed the bower dependency I found named recaptcha-ajax. Through some quick googlefu I have found two related questions found here and here, but still could not get it to work.
Since this is a common use case I am sure many people here have implemented Google’s Click ReCaptcha into their Ember projects. Can anyone point me in the right direction or inform me on how to debug this?
Any help whatsoever is greatly appreciated and will be compensated with good karma. Thank you in advance for your help.