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

feat: Addition of Fields for reCAPTCHA #3182

Merged
merged 7 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions app/components/forms/admin/settings/system-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,26 @@ export default Component.extend(FormMixin, {
]
},

googlereCAPTCHAsitekey: {
identifier : 'google_recaptcha_sitekey',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the reCAPTCHA site key')
}
]
},

googlereCAPTCHAsecretkey: {
identifier : 'google_recaptcha_secretkey',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the reCAPTCHA secret key')
}
]
},

emailFrom: {
identifier : 'email_from',
rules : [
Expand Down
4 changes: 4 additions & 0 deletions app/components/forms/admin/settings/system/captcha-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Component from '@ember/component';

export default Component.extend({
});
2 changes: 2 additions & 0 deletions app/models/custom-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ModelBase from 'open-event-frontend/models/base';
import { belongsTo } from 'ember-data/relationships';

export default ModelBase.extend({

fieldIdentifier : attr('string'),
form : attr('string'),
type : attr('string', { defaultValue: 'text' }),
Expand Down Expand Up @@ -86,6 +87,7 @@ export default ModelBase.extend({
} else {
name = this.get(`attendee.${name}`);
}

return name;
}),

Expand Down
125 changes: 64 additions & 61 deletions app/models/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,67 +8,70 @@ export default ModelBase.extend({
* Attributes
*/

appEnvironment : attr('string'),
appName : attr('string'),
tagline : attr('string'),
secret : attr('string'),
storagePlace : attr('string'),
awsKey : attr('string'),
awsSecret : attr('string'),
awsBucketName : attr('string'),
awsRegion : attr('string'),
gsKey : attr('string'),
gsSecret : attr('string'),
gsBucketName : attr('string'),
googleClientId : attr('string'),
googleClientSecret : attr('string'),
fbClientId : attr('string'),
fbClientSecret : attr('string'),
twConsumerKey : attr('string'),
twConsumerSecret : attr('string'),
inClientId : attr('string'),
inClientSecret : attr('string'),
paypalMode : attr('string'),
paypalClient : attr('string'),
paypalSecret : attr('string'),
paypalSandboxClient : attr('string'),
paypalSandboxSecret : attr('string'),
alipaySecretKey : attr('string'),
alipayPublishableKey : attr('string'),
omiseMode : attr('string'),
omiseTestPublic : attr('string'),
omiseTestSecret : attr('string'),
omiseLivePublic : attr('string'),
omiseLiveSecret : attr('string'),
stripeClientId : attr('string'),
stripeSecretKey : attr('string'),
stripePublishableKey : attr('string'),
isPaypalActivated : attr('boolean'),
isStripeActivated : attr('boolean'),
isAliPayActivated : attr('boolean'),
isOmiseActivated : attr('boolean'),
emailService : attr('string'),
emailFrom : attr('string'),
emailFromName : attr('string'),
sendgridKey : attr('string'),
smtpHost : attr('string'),
smtpUsername : attr('string'),
smtpPassword : attr('string'),
smtpPort : attr('string'),
smtpEncryption : attr('string'),
analyticsKey : attr('string'),
googleUrl : attr('string'),
githubUrl : attr('string'),
twitterUrl : attr('string'),
supportUrl : attr('string'),
facebookUrl : attr('string'),
youtubeUrl : attr('string'),
androidAppUrl : attr('string'),
frontendUrl : attr('string'),
webAppUrl : attr('string'),
staticDomain : attr('string'),
cookiePolicy : attr('string'),
cookiePolicyLink : attr('string'),
appEnvironment : attr('string'),
appName : attr('string'),
tagline : attr('string'),
secret : attr('string'),
storagePlace : attr('string'),
awsKey : attr('string'),
awsSecret : attr('string'),
awsBucketName : attr('string'),
awsRegion : attr('string'),
gsKey : attr('string'),
gsSecret : attr('string'),
gsBucketName : attr('string'),
isGoogleRecaptchaEnabled : attr('boolean', { defaultValue: false }),
googleRecaptchaSitekey : attr('string'),
googleRecaptchaSecretkey : attr('string'),
googleClientId : attr('string'),
googleClientSecret : attr('string'),
fbClientId : attr('string'),
fbClientSecret : attr('string'),
twConsumerKey : attr('string'),
twConsumerSecret : attr('string'),
inClientId : attr('string'),
inClientSecret : attr('string'),
paypalMode : attr('string'),
paypalClient : attr('string'),
paypalSecret : attr('string'),
paypalSandboxClient : attr('string'),
paypalSandboxSecret : attr('string'),
alipaySecretKey : attr('string'),
alipayPublishableKey : attr('string'),
omiseMode : attr('string'),
omiseTestPublic : attr('string'),
omiseTestSecret : attr('string'),
omiseLivePublic : attr('string'),
omiseLiveSecret : attr('string'),
stripeClientId : attr('string'),
stripeSecretKey : attr('string'),
stripePublishableKey : attr('string'),
isPaypalActivated : attr('boolean'),
isStripeActivated : attr('boolean'),
isAliPayActivated : attr('boolean'),
isOmiseActivated : attr('boolean'),
emailService : attr('string'),
emailFrom : attr('string'),
emailFromName : attr('string'),
sendgridKey : attr('string'),
smtpHost : attr('string'),
smtpUsername : attr('string'),
smtpPassword : attr('string'),
smtpPort : attr('string'),
smtpEncryption : attr('string'),
analyticsKey : attr('string'),
googleUrl : attr('string'),
githubUrl : attr('string'),
twitterUrl : attr('string'),
supportUrl : attr('string'),
facebookUrl : attr('string'),
youtubeUrl : attr('string'),
androidAppUrl : attr('string'),
frontendUrl : attr('string'),
webAppUrl : attr('string'),
staticDomain : attr('string'),
cookiePolicy : attr('string'),
cookiePolicyLink : attr('string'),

/**
* Computed properties
Expand Down
5 changes: 2 additions & 3 deletions app/templates/components/forms/admin/settings/system-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
{{input type='text' name='tag_line' value=settings.tagline}}
</div>
<div class="ui hidden divider"></div>

{{forms/admin/settings/system/social-media-token settings=settings}}


<div class="ui hidden divider"></div>
{{forms/admin/settings/system/captcha-form settings=settings}}
<div class="ui hidden divider"></div>
{{forms/admin/settings/system/storage-option settings=settings}}
<div class="ui hidden divider"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<h3 class="ui header">
{{t 'Captcha Options'}}
<div class="sub header">
{{t 'Captcha settings for sensitive actions in app.'}}
</div>
</h3>
<div class="inline field">
<label>
{{t 'Enable Google reCAPTCHA'}}
</label>
{{ui-checkbox class='toggle' checked=settings.isGoogleRecaptchaEnabled onChange=(action (mut settings.isGoogleRecaptchaEnabled))}}
</div>
{{#if settings.isGoogleRecaptchaEnabled}}
<h3 class="ui header">
{{t 'Google reCaptcha'}}
<div class="sub header">
{{t 'See'}}
<a href="https://www.google.com/recaptcha/intro/v3.html" target="_blank" rel="noopener nofollow">
{{t 'here'}}
</a>
{{t 'on how to obtain these keys.'}}
</div>
</h3>
<div class="field">
<label>
{{t 'Google reCAPTCHA Site Key'}}
</label>
{{input type='text' name='google_recaptcha_sitekey' value=settings.googleRecaptchaSitekey}}
</div>
<div class="field">
<label>
{{t 'Google reCAPTCHA Secret Key'}}
</label>
{{input type='text' name='google_recaptcha_secretkey' value=settings.googleRecaptchaSecretkey}}
</div>
{{/if}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | forms/admin/settings/system/captcha-form', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {

await render(hbs`{{forms/admin/settings/system/captcha-form}}`);

assert.ok(this.element.innerHTML.trim().includes('Captcha Options'));

});
});