function user_restrictions_login_form_validate in User restrictions 7
Form validation handler for user_login(), and user_login_block().
See also
2 string references to 'user_restrictions_login_form_validate'
- user_restrictions_form_user_login_alter in ./
user_restrictions.module - Implements hook_form_FORM_ID_alter() for user_login().
- user_restrictions_form_user_login_block_alter in ./
user_restrictions.module - Implements hook_form_FORM_ID_alter() for user_login_block().
File
- ./
user_restrictions.module, line 153 - Specifies rules for restricting the data users can set for their accounts.
Code
function user_restrictions_login_form_validate($form, &$form_state) {
if (!empty($form_state['uid']) && isset($form_state['values']['name'])) {
$account = user_load($form_state['uid']);
if (!empty($account)) {
if (user_access('bypass user restriction rules', $account)) {
return;
}
$error = UserRestrictions::check($form_state, 'login');
if ($error['message']) {
form_set_error($error['field'], $error['message']);
}
}
}
}