Merge branch 'dubbele-authenticatie-IN-TEST' into develop

This commit is contained in:
Liesbeth ter Schure
2024-08-22 09:57:29 +02:00
21 changed files with 628 additions and 65 deletions
+61
View File
@@ -0,0 +1,61 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**Mail_model ls augustus 2024 */
class Mail_model extends MY_Model{
// protected $tablename = "tb_users";
// public $gID;
function __construct(){
parent::__construct();
$models = array();
$this->load->model($models);
}
function sendTheEmail( $to, $subject, $html, $cc = FALSE){
$this->load->library( 'email' );
$result = "Success";
if ( ! is_array( $to ) ) $to = (array) $to;
foreach ( $to as $receiver ){
$mailParts = explode( '@', $receiver );
if (! $mailParts || count($mailParts) < 2) return $result="Er gaat iets fout met e-mail adres ".$receiver;
// moet dit gebeuren? $this->setmail();
$this->email->to( $receiver );
$this->email->from( 'info@monpas.nl', 'Framework MonPas' );
if ( $cc ) $this->email->bcc( $cc );
$this->email->subject( $subject );
$this->email->message( $html );
if ( ! $this->email->send() ){
$result = $this->email->print_debugger();
};
}
return $result;
}
private function setmail(){
if ( ENVIRONMENT == 'production' ){
$config['smtp_host'] = $_ENV['MAILGUN']['HOST'];
$config['smtp_port'] = $_ENV['MAILGUN']['SMTP_PORT'];
$config['smtp_user'] = $_ENV['MAILGUN']['SMTP_USER'];
$config['smtp_pass'] = $_ENV['MAILGUN']['SMTP_PASS'];
} else {
$config['smtp_host'] = $_ENV['MAIL']['HOST'];
$config['smtp_port'] = $_ENV['MAIL']['SMTP_PORT'];
$config['smtp_user'] = $_ENV['MAIL']['SMTP_USER'];
$config['smtp_pass'] = $_ENV['MAIL']['SMTP_PASS'];
}
$this->email->initialize( $config );
}
} // model
+3 -2
View File
@@ -32,7 +32,7 @@ class Users_model extends MY_Model{
return $rij->fullname;
}
function getdetails ($userid){
$this->sql = "SELECT voornaam , tussenvoegsel, achternaam, email, zout
$this->sql = "SELECT voornaam , tussenvoegsel, achternaam, email, zout, twofactor
FROM tb_users
WHERE id = $userid";
return $this->get_query_row();
@@ -40,7 +40,8 @@ class Users_model extends MY_Model{
function getorggebruikers($orgid,$userid=false){
$this->sql = "SELECT U.id as userid, voornaam, tussenvoegsel, achternaam, email,gnaam, U.actief,
A.nivo_id, AN.naam as autorisatienaam, if (AN.nivo > 0, TRUE,FALSE) as OUactief
A.nivo_id, AN.naam as autorisatienaam, if (AN.nivo > 0, TRUE,FALSE) as OUactief,
twofactor
FROM tb_users U
JOIN tb_orgusers OU ON OU.user_id= U.id
JOIN tb_autorisaties A ON A.orguser_id = OU.id