diff --git a/app/views/shared/_create_account_form.html.erb b/app/views/shared/_create_account_form.html.erb
index c9d8cba..e493c79 100644
--- a/app/views/shared/_create_account_form.html.erb
+++ b/app/views/shared/_create_account_form.html.erb
@@ -43,8 +43,8 @@
<%= f.label(:accept_terms,
- raw("#{ f.check_box(:accept_terms) } #{_('I accept the')}
#{_('terms and conditions')} ")) %>
+ raw("#{ f.check_box(:accept_terms, "aria-required": true, "data-validation-error": _('You must agree to the term and conditions.')) } #{_('I accept the')}
#{_('terms and conditions')} ")) %>
- <%= f.button(_('Sign in'), class: "btn btn-default", type: "submit") %>
+ <%= f.button(_('Create account'), class: "btn btn-default", type: "submit") %>
<% end %>
diff --git a/app/views/shared/_sign_in_form.html.erb b/app/views/shared/_sign_in_form.html.erb
index a542b5e..e032ead 100644
--- a/app/views/shared/_sign_in_form.html.erb
+++ b/app/views/shared/_sign_in_form.html.erb
@@ -22,7 +22,7 @@
<%= f.email_field(:email, class: 'form-control', "aria-required": true) %>
- <%= f.label :remember_me, raw("#{f.check_box :remember_me}#{_('Remember email')}") %>
+ <%= label_tag 'remember_email', raw("#{check_box_tag 'remember_email'}#{_('Remember email')}") %>
<%= f.label(:password, _('Password'), class: 'control-label') %>
diff --git a/lib/assets/javascripts/utils/ariatiseForm.js b/lib/assets/javascripts/utils/ariatiseForm.js
index 2db61b3..00705a2 100644
--- a/lib/assets/javascripts/utils/ariatiseForm.js
+++ b/lib/assets/javascripts/utils/ariatiseForm.js
@@ -16,6 +16,13 @@
be run if the field has a value.
Example: ` `
+ Validation with a custom error message
+ ------------------------
+ To add a custom error message to a field's validation (default messages can be found
+ in the constants.js file) just add a 'data-validation-error' attribute to the field.
+ Example: ` `
+
Validation for radio buttons
------------------------
To add validation to a set of `radio` buttons, use the rules listed above,
diff --git a/lib/assets/javascripts/views/orgs/shibboleth_ds.js b/lib/assets/javascripts/views/orgs/shibboleth_ds.js
index b113489..f186b93 100644
--- a/lib/assets/javascripts/views/orgs/shibboleth_ds.js
+++ b/lib/assets/javascripts/views/orgs/shibboleth_ds.js
@@ -11,11 +11,11 @@
$('#show_list').click((e) => {
e.preventDefault();
- if ($('#full_list').is('.hide')) {
- $('#full_list').show();
+ if ($('#full_list').is('.hidden')) {
+ $('#full_list').removeClass('hidden').attr('aria-hidden', 'false');
$(e.currentTarget).html(SHIBBOLETH_DISCOVERY_SERVICE_HIDE_LIST);
} else {
- $('#full_list').hide();
+ $('#full_list').addClass('hidden').attr('aria-hidden', 'true');
$(e.currentTarget).html(SHIBBOLETH_DISCOVERY_SERVICE_SHOW_LIST);
}
});
diff --git a/lib/assets/javascripts/views/plans/index.js b/lib/assets/javascripts/views/plans/index.js
index a504bbb..9124c6b 100644
--- a/lib/assets/javascripts/views/plans/index.js
+++ b/lib/assets/javascripts/views/plans/index.js
@@ -24,7 +24,7 @@
});
};
- $("input[type='checkbox']").on('click, change', (e) => {
+ $("#my-plans input[type='checkbox']").on('click, change', (e) => {
checkboxHandler(e.currentTarget);
});
});
diff --git a/lib/assets/javascripts/views/shared/sign_in_form.js b/lib/assets/javascripts/views/shared/sign_in_form.js
index baac16e..f265b67 100644
--- a/lib/assets/javascripts/views/shared/sign_in_form.js
+++ b/lib/assets/javascripts/views/shared/sign_in_form.js
@@ -1,7 +1,32 @@
+import * as Cookies from 'js-cookie';
import ariatiseForm from '../../utils/ariatiseForm';
import { togglisePasswords } from '../../utils/passwordHelper';
$(() => {
ariatiseForm({ selector: '#sign_in_form' });
togglisePasswords({ selector: '#sign_in_form' });
+
+ const email = Cookies.get('dmproadmap_email');
+
+ // If the user's email was stored in the browser's cookies the pre-populate the field
+ if (email && email !== '') {
+ $('#sign_in_form #remember_email').attr('checked', 'checked');
+ $('#sign_in_form #user_email').val(email);
+ }
+
+ // When the user checks the 'remember email' box store the value in the browser storage
+ $('#sign_in_form #remember_email').click((e) => {
+ if ($(e.currentTarget).is(':checked')) {
+ Cookies.set('dmproadmap_email', $('#sign_in_form #user_email').val(), { expires: 14 });
+ } else {
+ Cookies.remove('dmproadmap_email');
+ }
+ });
+
+ // If the email is changed and the user has asked to remember it update the browser storage
+ $('#sign_in_form #user_email').change((e) => {
+ if ($('#sign_in_form #remember_email').is(':checked')) {
+ Cookies.set('dmproadmap_email', $(e.currentTarget).val(), { expires: 14 });
+ }
+ });
});
diff --git a/lib/assets/package-lock.json b/lib/assets/package-lock.json
index d43dad4..fdd4011 100644
--- a/lib/assets/package-lock.json
+++ b/lib/assets/package-lock.json
@@ -4676,6 +4676,11 @@
"integrity": "sha1-8OgK4DmkvWVLXygfyT8EqRSn/M4=",
"dev": true
},
+ "js-cookie": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.1.4.tgz",
+ "integrity": "sha1-2k7FA4ZvFJ0WTPJfV57zEBUCXY0="
+ },
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
diff --git a/lib/assets/package.json b/lib/assets/package.json
index 21e1786..47fcbdc 100644
--- a/lib/assets/package.json
+++ b/lib/assets/package.json
@@ -24,6 +24,7 @@
"jquery-accessible-autocomplete-list-aria": "1.5.5",
"jquery-ui-dist": "1.12.1",
"jquery-ujs": "1.2.2",
+ "js-cookie": "2.1.4",
"placeholder": "1.0.2",
"tablesorter": "2.28.15",
"timeago": "1.6.1",