Subversion Repositories Applications.annuaire

Rev

Rev 359 | Rev 401 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 359 Rev 395
Line 16... Line 16...
16
	private $nom_cookie_persistant = '';
16
	private $nom_cookie_persistant = '';
17
	private $duree_identification = '0';
17
	private $duree_identification = '0';
18
	private $fonction_cryptage_mdp_cookie = 'md5';
18
	private $fonction_cryptage_mdp_cookie = 'md5';
19
	private $objet_identification = null;
19
	private $objet_identification = null;
Line 20... Line -...
20
	
-
 
21
	/*public function IdentificationControleur() {
-
 
22
 
-
 
23
		Controleur::__construct();
-
 
24
		$this->cookie_persistant_nom = session_name().'-memo';
-
 
25
		$this->cookie_persistant_nom = 'pap-admin_papyrus_-memo';
-
 
26
		$this->duree_identification = time()+Config::get('duree_session_identification');
-
 
27
		$this->fonction_cryptage_mdp_cookie = Config::get('fonction_cryptage_mdp_cookie');
-
 
28
		
-
 
29
	}*/
-
 
30
 
20
 
31
	public function afficherFormulaireIdentification($id_annuaire, $donnees = array()) {
-
 
32
 
21
	public function afficherFormulaireIdentification($id_annuaire, $donnees = array()) {
33
		$this->chargerModele('AnnuaireModele');
22
		$this->chargerModele('AnnuaireModele');
Line 34... Line 23...
34
		$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
23
		$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
35
 
24
 
Line 41... Line 30...
41
 
30
 
42
		return $this->getVue(Config::get('dossier_squelettes_formulaires').'identification',$donnees);
31
		return $this->getVue(Config::get('dossier_squelettes_formulaires').'identification',$donnees);
Line 43... Line 32...
43
	}
32
	}
44
	
-
 
45
	public function loggerUtilisateur($utilisateur, $pass) {
33
 
Line 46... Line -...
46
		
-
 
47
		$this->objet_identification = Config::get('objet_identification');
34
	public function loggerUtilisateur($utilisateur, $pass) {
Line 48... Line 35...
48
		
35
		$this->objet_identification = Config::get('objet_identification');
49
		// on cree le cookie
36
 
50
		$this->creerCookie($utilisateur, $pass);
37
		$this->creerCookie($utilisateur, $pass);
51
		
38
 
Line 52... Line 39...
52
		// On loggue l'utilisateur
39
		// Loguer l'utilisateur
53
		$this->objet_identification->username = $utilisateur;
40
		$this->objet_identification->username = $utilisateur;
Line 54... Line 41...
54
		$this->objet_identification->password = $pass;
41
		$this->objet_identification->password = $pass;
55
		$this->objet_identification->login();
-
 
56
 
42
		$this->objet_identification->login();
57
		return true;
43
 
58
	}
-
 
59
	
44
		return true;
60
	public function deLoggerUtilisateur() {
45
	}
Line 61... Line 46...
61
		
46
 
62
		$this->objet_identification = Config::get('objet_identification');
47
	public function deLoggerUtilisateur() {
Line 71... Line 56...
71
		$pass = $this->objet_identification->password;
56
		$pass = $this->objet_identification->password;
72
		$this->creerCookie($nom_utilisateur, $pass, true);
57
		$this->creerCookie($nom_utilisateur, $pass, true);
73
	}
58
	}
Line 74... Line 59...
74
	
59
 
75
	public function creerCookie($utilisateur, $pass, $pass_deja_crypte = false) {
-
 
76
		
60
	public function creerCookie($utilisateur, $pass, $pass_deja_crypte = false) {
Line 77... Line 61...
77
		$this->objet_identification = Config::get('objet_identification');
61
		$this->objet_identification = Config::get('objet_identification');
78
		
62
 
79
		// Expiration si l'utilisateur ne referme pas son navigateur
63
		// Expiration si l'utilisateur ne referme pas son navigateur
-
 
64
		$this->objet_identification->setExpire(0);
80
		$this->objet_identification->setExpire(0);
65
		$this->objet_identification->setIdle(0);
81
		$this->objet_identification->setIdle(0);
66
 
82
		// Création d'un cookie pour rendre permanente l'identification de Papyrus
67
		// Création d'un cookie pour rendre permanente l'identification de Papyrus
83
		if(!$pass_deja_crypte) {
68
		if (!$pass_deja_crypte) {
84
			$pass_crypt = md5($pass); 
69
			$pass_crypt = md5($pass);
Line 88... Line 73...
88
		$cookie_val = $pass_crypt.$utilisateur;
73
		$cookie_val = $pass_crypt.$utilisateur;
89
		setcookie(session_name().'-memo', $cookie_val, 0, '/');		
74
		setcookie(session_name().'-memo', $cookie_val, 0, '/');
90
	}
75
	}
Line 91... Line 76...
91
	
76
 
92
	public function obtenirLoginUtilisateurParCookie() {
-
 
93
 
77
	public function obtenirLoginUtilisateurParCookie() {
Line 94... Line 78...
94
		$nom_session = Config::get('nom_session');
78
		$nom_session = Config::get('nom_session');
95
		
79
 
96
		if(isset($_COOKIE[$nom_session])) {
80
		if (isset($_COOKIE[$nom_session])) {
97
			$cookie_val = $_COOKIE[$nom_session];
81
			$cookie_val = $_COOKIE[$nom_session];
98
			$login_utilisateur = substr($cookie_val, '32', strlen($cookie_val));
82
			$login_utilisateur = substr($cookie_val, '32', strlen($cookie_val));
99
			return $login_utilisateur;
83
			return $login_utilisateur;
100
		} else {
84
		} else {
101
			return false;
-
 
102
		}
85
			return false;
103
		
86
		}
104
	}
87
	}
105
}
88
}