Commit 556ebcfb authored by Dave Reid's avatar Dave Reid
Browse files

Added validation for realname_settings_form() to prevent the [user:name] token from being used.

parent b52ca8a9
<?php
/**
* Form builder; display the realname settings form.
* Form constructor for the Real name settings form.
*
* @see realname_settings_form_validate()
* @see realname_settings_form_submit()
*/
function realname_settings_form($form, &$form_state) {
......@@ -29,9 +30,20 @@ function realname_settings_form($form, &$form_state) {
}
/**
* Form submit handler for the realname settings form.
* Form validation handler for realname_settings_form().
*
* @see realname_settings_form().
* @see realname_settings_form_submit()
*/
function realname_settings_form_validate($form, &$form_state) {
if (strpos($form_state['values']['realname_pattern'], '[user:name]') !== FALSE) {
form_set_error('realname_pattern', t('The <em>[user:name]</em> token cannot be used as it will cause recursion.'));
}
}
/**
* Form submission handler for realname_settings_form().
*
* @see realname_settings_form_validate()
*/
function realname_settings_form_submit($form, $form_state) {
if ($form['realname_pattern']['#default_value'] != $form_state['values']['realname_pattern']) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment