예제 #1
0
 /** 
  * Sends out reminders for callers. 
  */
 public function callers()
 {
     if (!$this->input->is_cli_request()) {
         echo "This script can only be accessed via the command line" . PHP_EOL;
         return;
     }
     $users = $this->userModel->get_all_callers();
     foreach ($users as $user) {
         reset_language(user_language($user));
         $this->email->clear();
         $this->email->from(FROM_EMAIL, FROM_EMAIL_NAME);
         $this->email->to(in_development() ? TO_EMAIL_OVERRIDE : $user->email);
         $this->email->subject(lang('rem_subject'));
         $call_messages = array();
         $experiments = $this->callerModel->get_experiments_by_caller($user->id);
         foreach ($experiments as $experiment) {
             if ($experiment->archived != 1) {
                 $count = count($this->participantModel->find_participants($experiment));
                 if ($count > 0) {
                     array_push($call_messages, sprintf(lang('rem_exp_call'), $experiment->name, $count));
                 }
             }
         }
         if ($call_messages) {
             $message = sprintf(lang('mail_heading'), $user->username);
             $message .= br(2);
             $message .= lang('rem_body');
             $message .= br(1);
             $message .= ul($call_messages);
             $message .= lang('mail_ending');
             $message .= br(2);
             $message .= lang('mail_disclaimer');
             $this->email->message($message);
             $this->email->send();
             // DEBUG: echo $this->email->print_debugger();
         }
     }
 }
예제 #2
0
        $_POST['phone'] = $myrow["phone"];
        $_POST['email'] = $myrow["email"];
        $_POST['role_id'] = $myrow["role_id"];
        $_POST['language'] = $myrow["language"];
        $_POST['print_profile'] = $myrow["print_profile"];
        $_POST['rep_popup'] = $myrow["rep_popup"];
        $_POST['pos'] = $myrow["pos"];
    }
    hidden('selected_id', $selected_id);
    hidden('user_id');
    start_row();
    label_row(_("User login:"******"User Login:"******"user_id", null, 22, 20);
    $_POST['language'] = user_language();
    $_POST['print_profile'] = user_print_profile();
    $_POST['rep_popup'] = user_rep_popup();
    $_POST['pos'] = user_pos();
}
$_POST['password'] = "";
password_row(_("Password:"******"Enter a new password to change, leave empty to keep current."));
}
text_row_ex(_("Full Name") . ":", 'real_name', 50);
text_row_ex(_("Telephone No.:"), 'phone', 30);
email_row_ex(_("Email Address:"), 'email', 50);
security_roles_list_row(_("Access Level:"), 'role_id', null);
languages_list_row(_("Language:"), 'language', null);
pos_list_row(_("User's POS") . ':', 'pos', null);
예제 #3
0
 /**
  *
  * Submits the password reset request
  * @param $language
  */
 public function forgot_password_submit($language = L::English)
 {
     reset_language($language);
     // Validation rules
     $this->form_validation->set_rules('email', lang('email'), 'trim|required|valid_email|callback_email_exists|callback_reset_request_sent');
     // Run validation
     if ($this->form_validation->run() == FALSE) {
         // If not succeeded, show form again with error messages
         $this->forgot_password();
     } else {
         // If succeeded, lookup user by e-mail address and send password reset e-mail.
         $user = $this->userModel->get_user_by_email($this->input->post('email'));
         $url = bin2hex(openssl_random_pseudo_bytes(8));
         $reset_request = array('activated' => NULL, 'resetrequeststring' => $url, 'resetrequesttime' => input_datetime());
         $this->userModel->update_user($user->id, $reset_request);
         // Send out reset e-mail
         reset_language(user_language($user));
         $this->email->clear();
         $this->email->from(FROM_EMAIL, FROM_EMAIL_NAME);
         $this->email->to(in_development() ? TO_EMAIL_OVERRIDE : $user->email);
         $this->email->subject(lang('resetpw_subject'));
         $message = sprintf(lang('mail_heading'), $user->username);
         $message .= br(2);
         $message .= sprintf(lang('resetpw_body'), anchor(base_url() . 'resetpw/' . $url));
         $message .= br(2);
         $message .= lang('mail_ending');
         $message .= br(2);
         $message .= lang('mail_disclaimer');
         $this->email->message($message);
         $this->email->send();
         // Show success
         flashdata(sprintf(lang('forgot_pw_sent'), $user->email));
         redirect('login', 'refresh');
     }
 }
예제 #4
0
 /** Deactivates the specified participant */
 public function deactivate($participant_id)
 {
     $this->participantModel->deactivate($participant_id, DeactivateReason::Manual);
     $p = $this->participantModel->get_participant_by_id($participant_id);
     // Inform all admins of this deactivation
     $url = $this->config->site_url() . 'participant/get/' . $participant_id;
     $users = $this->userModel->get_all_admins();
     foreach ($users as $user) {
         reset_language(user_language($user));
         $this->email->clear();
         $this->email->from(FROM_EMAIL, FROM_EMAIL_NAME);
         $this->email->to(in_development() ? TO_EMAIL_OVERRIDE : $user->email);
         $this->email->subject(lang('dereg_pp_subject'));
         $message = sprintf(lang('mail_heading'), $user->username);
         $message .= br(2);
         $message .= sprintf(lang('deac_pp_body'), name($p), $p->phone, current_username(), $url, $url);
         $message .= br(2);
         $message .= lang('mail_ending');
         $message .= br(2);
         $message .= lang('mail_disclaimer');
         $this->email->message($message);
         $this->email->send();
     }
     flashdata(sprintf(lang('p_deactivated'), name($p)));
     redirect($this->agent->referrer(), 'refresh');
 }
예제 #5
0
		<th><?php 
echo lang('email');
?>
</th>
		<td><?php 
echo mailto($user->email);
?>
</td>
	</tr>
	<tr>
		<th><?php 
echo lang('preferredlanguage');
?>
</th>
		<td><?php 
echo lang(user_language($user));
?>
</td>
	</tr>
</table>

<!-- Experiments -->
<?php 
if (is_admin()) {
    echo heading(lang('experiments'), 3);
    create_experiment_table('experiments');
    $experiments['id'] = 'experiments';
    $experiments['ajax_source'] = 'experiment/table_by_user/' . $user->id;
    echo $this->load->view('templates/list_view', $experiments);
}
?>
예제 #6
0
 /** Authenticates username and password. Returns true if authentication was successful. */
 public function authenticate()
 {
     $username = $this->input->post('username');
     $password = $this->input->post('password');
     $user = $this->userModel->get_user_by_username($username);
     // If username found in DB...
     if ($user) {
         // Check against password and if activated
         if (!$this->phpass->check($password, $user->password) || !is_activated($user)) {
             $this->session->sess_destroy();
             return FALSE;
         } else {
             // Destroy old session
             $this->session->sess_destroy();
             // Create a fresh, brand new session
             $this->session->sess_create();
             // Remove the password field
             unset($user->password);
             // Set session data
             $session_data = array('username' => $username, 'user_id' => $user->id, 'user_role' => $user->role, 'role' => $user->role, 'logged_in' => TRUE, 'language' => user_language($user));
             $this->session->set_userdata($session_data);
             // Login was successful
             return TRUE;
         }
     } else {
         $this->session->sess_destroy();
         return FALSE;
     }
 }