function janrain_capture_settings_validate in Janrain Registration 7
Validate callback for the settings form.
1 string reference to 'janrain_capture_settings_validate'
- janrain_capture_settings in ./
janrain_capture.admin.inc - Sets up the admin settings form for this module.
File
- ./
janrain_capture.admin.inc, line 137 - Admin settings menu
Code
function janrain_capture_settings_validate($form, &$form_state) {
if ($form_state['values']['janrain_capture_enforce']) {
// Do not allow the "enforce" setting to be set if the basic application
// settings have not been set.
if (empty($form_state['values']['janrain_capture_main']['capture_client_id']) || empty($form_state['values']['janrain_capture_main']['capture_client_secret']) || empty($form_state['values']['janrain_capture_main']['capture_address'])) {
form_set_error('janrain_capture_enforce', t('You cannot enforce Janrain Capture for login because you have not configured the application settings. You must at least provide a Janrain Capture Client ID, Janrain Capture Client Secret and Janrain Capture Address'));
}
else {
// Do not allow the current user to set the "enforce" property if they do
// not have a Capture account themselves. Otherwise they could lock themselves
// out of the site.
$api = new JanrainCaptureApi();
$profile = $api
->loadUserEntity();
if (!$profile) {
form_set_error('janrain_capture_enforce', t('You cannot enforce Janrain Capture for login because you do not have a Janrain Capture account and would no longer be able to log into this site.'));
}
}
}
if ($form_state['values']['janrain_capture_fields']['capture_match_email'] && !$form_state['values']['janrain_capture_fields']['capture_enforce_verification']) {
form_set_error('janrain_capture_fields][capture_match_email', t('You must enable the Enforce Email Verification setting in order to enable the Match Users on Email setting.'));
}
}