if (OFF == config_get('use_ldap_email')) { $f_email = email_append_domain($f_email); email_ensure_valid($f_email); email_ensure_not_disposable($f_email); if ($f_email != user_get_email($t_user_id)) { user_set_email($t_user_id, $f_email); $t_email_updated = true; } } # strip extra spaces from real name $t_realname = string_normalize($f_realname); if ($t_realname != user_get_field($t_user_id, 'realname')) { # checks for problems with realnames $t_username = user_get_field($t_user_id, 'username'); user_ensure_realname_unique($t_username, $t_realname); user_set_realname($t_user_id, $t_realname); $t_realname_updated = true; } # Update password if the two match and are not empty if (!is_blank($f_password)) { if ($f_password != $f_password_confirm) { trigger_error(ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR); } else { if (!auth_does_password_match($t_user_id, $f_password)) { user_set_password($t_user_id, $f_password); $t_password_updated = true; } } } form_security_purge('account_update'); html_page_top(null, $t_redirect);
private function get_user($p_parsed_from) { if ($this->_mail_use_reporter) { // Always report as mail_reporter $t_reporter_id = $this->_mail_reporter_id; } else { // Try to get the reporting users id $t_reporter_id = $this->get_userid_from_email($p_parsed_from['email']); if (!$t_reporter_id) { if ($this->_mail_auto_signup) { // So, we have to sign up a new user... $t_new_reporter_name = $this->prepare_username($p_parsed_from); if ($t_new_reporter_name !== FALSE && $this->validate_email_address($p_parsed_from['email'])) { if (user_signup($t_new_reporter_name, $p_parsed_from['email'])) { # notify the selected group a new user has signed-up email_notify_new_account($t_new_reporter_name, $p_parsed_from['email']); $t_reporter_id = user_get_id_by_email($p_parsed_from['email']); $t_reporter_name = $t_new_reporter_name; $t_realname = $this->prepare_realname($p_parsed_from, $t_reporter_name); if ($t_realname !== FALSE) { user_set_realname($t_reporter_id, $t_realname); } } } if (!$t_reporter_id) { $this->custom_error('Failed to create user based on: ' . $p_parsed_from['From']); } } } if ((!$t_reporter_id || !user_is_enabled($t_reporter_id)) && $this->_mail_fallback_mail_reporter) { // Fall back to the default mail_reporter $t_reporter_id = $this->_mail_reporter_id; } } if ($t_reporter_id && user_is_enabled($t_reporter_id)) { if (!isset($t_reporter_name)) { $t_reporter_name = user_get_field($t_reporter_id, 'username'); } $t_authattemptresult = auth_attempt_script_login($t_reporter_name); # last attempt for fallback if ($t_authattemptresult === FALSE && $this->_mail_fallback_mail_reporter && $t_reporter_id != $this->_mail_reporter_id && user_is_enabled($this->_mail_reporter_id)) { $t_reporter_id = $this->_mail_reporter_id; $t_reporter_name = user_get_field($t_reporter_id, 'username'); $t_authattemptresult = auth_attempt_script_login($t_reporter_name); } if ($t_authattemptresult === TRUE) { user_update_last_visit($t_reporter_id); return (int) $t_reporter_id; } } // Normally this function does not get here unless all else failed $this->custom_error('Could not get a valid reporter. Email will be ignored'); return FALSE; }