user password bug fixe
This commit is contained in:
parent
eeccd6a4d2
commit
4362f6dc23
@ -120,54 +120,54 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
|
||||
if( $form_id == "webform_client_form_11186" ){
|
||||
// dsm($form, '$form');
|
||||
$form['#validate'][] = "materio_user_webform_client_111186_validate";
|
||||
$form['#submit'][] = "materio_user_webform_client_111186_submit";
|
||||
// $form['#submit'][] = "materio_user_webform_client_111186_submit";
|
||||
}
|
||||
|
||||
|
||||
if( $form_id == "user_profile_form" ){
|
||||
//dsm($form, '$form');
|
||||
$form['account']['pass']['#type'] = "new_password_confirm";
|
||||
}
|
||||
// if( $form_id == "user_profile_form" ){
|
||||
// //dsm($form, '$form');
|
||||
// $form['account']['pass']['#type'] = "new_password_confirm";
|
||||
// }
|
||||
}
|
||||
|
||||
function materio_user_element_info() {
|
||||
return array(
|
||||
"new_password_confirm" => array(
|
||||
'#input' => TRUE,
|
||||
'#process' => array('materio_user_process_new_password_confirm'),
|
||||
'#theme_wrappers' => array('form_element'),
|
||||
),
|
||||
);
|
||||
}
|
||||
// function materio_user_element_info() {
|
||||
// return array(
|
||||
// "new_password_confirm" => array(
|
||||
// '#input' => TRUE,
|
||||
// '#process' => array('materio_user_process_new_password_confirm'),
|
||||
// '#theme_wrappers' => array('form_element'),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Expand a password_confirm field into two text boxes.
|
||||
*/
|
||||
function materio_user_process_new_password_confirm($element) {
|
||||
$element['pass1'] = array(
|
||||
'#type' => 'password',
|
||||
'#title' => t('New password'),
|
||||
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
|
||||
'#required' => $element['#required'],
|
||||
'#attributes' => array('class' => array('password-field')),
|
||||
);
|
||||
$element['pass2'] = array(
|
||||
'#type' => 'password',
|
||||
'#title' => t('Confirm password'),
|
||||
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
|
||||
'#required' => $element['#required'],
|
||||
'#attributes' => array('class' => array('password-confirm')),
|
||||
);
|
||||
$element['#element_validate'] = array('password_confirm_validate');
|
||||
$element['#tree'] = TRUE;
|
||||
// function materio_user_process_new_password_confirm($element) {
|
||||
// $element['pass1'] = array(
|
||||
// '#type' => 'password',
|
||||
// '#title' => t('New password'),
|
||||
// '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
|
||||
// '#required' => $element['#required'],
|
||||
// '#attributes' => array('class' => array('password-field')),
|
||||
// );
|
||||
// $element['pass2'] = array(
|
||||
// '#type' => 'password',
|
||||
// '#title' => t('Confirm password'),
|
||||
// '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
|
||||
// '#required' => $element['#required'],
|
||||
// '#attributes' => array('class' => array('password-confirm')),
|
||||
// );
|
||||
// $element['#element_validate'] = array('password_confirm_validate');
|
||||
// $element['#tree'] = TRUE;
|
||||
|
||||
if (isset($element['#size'])) {
|
||||
$element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
|
||||
}
|
||||
// if (isset($element['#size'])) {
|
||||
// $element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
|
||||
// }
|
||||
|
||||
return $element;
|
||||
}
|
||||
// return $element;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@ -227,40 +227,40 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
|
||||
|
||||
}
|
||||
|
||||
function materio_user_webform_client_111186_submit($form, &$form_state){
|
||||
dsm($form, 'form');
|
||||
dsm($form_state, 'form_state');
|
||||
$values = $form_state['values']['submitted_tree'];
|
||||
if ($values['membership_options'] == 3) {
|
||||
$i = 1;
|
||||
foreach ($values['collaborators'] as $coll_key => $coll) {
|
||||
// foreach ($coll as $field_key => $field_value) {
|
||||
// if($field_value == ''){
|
||||
// $human_field_name = $form['submitted']['collaborators'][$coll_key]['#title'] . " : " . $form['submitted']['collaborators'][$coll_key][$field_key]['#title'];
|
||||
// $field_name = 'submitted][collaborators]['.$coll_key.']['.$field_key;
|
||||
// // dsm($field_name, 'field_name');
|
||||
// function materio_user_webform_client_111186_submit($form, &$form_state){
|
||||
// dsm($form, 'form');
|
||||
// dsm($form_state, 'form_state');
|
||||
// $values = $form_state['values']['submitted_tree'];
|
||||
// if ($values['membership_options'] == 3) {
|
||||
// $i = 1;
|
||||
// foreach ($values['collaborators'] as $coll_key => $coll) {
|
||||
// // foreach ($coll as $field_key => $field_value) {
|
||||
// // if($field_value == ''){
|
||||
// // $human_field_name = $form['submitted']['collaborators'][$coll_key]['#title'] . " : " . $form['submitted']['collaborators'][$coll_key][$field_key]['#title'];
|
||||
// // $field_name = 'submitted][collaborators]['.$coll_key.']['.$field_key;
|
||||
// // // dsm($field_name, 'field_name');
|
||||
|
||||
// form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
|
||||
// }
|
||||
// }
|
||||
$userinfo = array(
|
||||
'mail' => $coll['e_mail_collab_'.$i],
|
||||
'name' => user_password(),
|
||||
'pass' => user_password(), // Generate password
|
||||
// 'init' => $data['components']['username']['value'],
|
||||
'status' => 0,
|
||||
'access' => REQUEST_TIME,
|
||||
'memo' => 'from webform',
|
||||
);
|
||||
$account = drupal_anonymous_user();
|
||||
$account->is_new = TRUE;
|
||||
user_save($account, $userinfo);
|
||||
// module_invoke_all('user_insert', $edit, $account);
|
||||
$i++;
|
||||
}
|
||||
// // form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));
|
||||
// // }
|
||||
// // }
|
||||
// $userinfo = array(
|
||||
// 'mail' => $coll['e_mail_collab_'.$i],
|
||||
// 'name' => user_password(),
|
||||
// 'pass' => user_password(), // Generate password
|
||||
// // 'init' => $data['components']['username']['value'],
|
||||
// 'status' => 0,
|
||||
// 'access' => REQUEST_TIME,
|
||||
// 'memo' => 'from webform',
|
||||
// );
|
||||
// $account = drupal_anonymous_user();
|
||||
// $account->is_new = TRUE;
|
||||
// user_save($account, $userinfo);
|
||||
// // module_invoke_all('user_insert', $edit, $account);
|
||||
// $i++;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// enregistrer le type d'adonnement chez les user
|
||||
|
||||
@ -313,7 +313,7 @@ define('MATERIO_USER_CONFIRMED_USER_ROLE', 'Utilisateur'); // add role name here
|
||||
/**
|
||||
* Implement hook_user
|
||||
*/
|
||||
function materio_user_user_update(&$edit, $account, $category){
|
||||
function _materio_user_user_update(&$edit, $account, $category){
|
||||
// dsm($edit, 'edit');
|
||||
// dsm($account, 'account');
|
||||
// dsm($category, 'category');
|
||||
|
Loading…
x
Reference in New Issue
Block a user