Created
February 4, 2011 01:18
-
-
Save mishudark/810570 to your computer and use it in GitHub Desktop.
Validate user register o create
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function inseguridad_form_user_register_alter(&$form, &$form_state) { | |
| if(preg_match("/register|user\/create/",$_SERVER['REQUEST_URI']) ){ | |
| $form['#validate'][] = 'inseguridad_user_register_validate'; | |
| } | |
| } | |
| function inseguridad_user_register_validate($form, &$form_state){ | |
| $pass1 = $form['#parameters'][1]['post']['pass']['pass1']; | |
| if( preg_match("/[^a-zA-Z0-9]/",$pass1)) | |
| form_set_error('inseguridad', t("La contraseña solo admite números y letras mayúsculas y minúsculas.")); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment