Subversion Repositories Applications.annuaire

Rev

Rev 401 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 401 Rev 429
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 -... Line 20...
-
 
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
	}*/
20
 
30
 
-
 
31
	public function afficherFormulaireIdentification($id_annuaire, $donnees = array()) {
21
	public function afficherFormulaireIdentification($id_annuaire, $donnees = array()) {
32
 
22
		$this->chargerModele('AnnuaireModele');
33
		$this->chargerModele('AnnuaireModele');
Line 23... Line 34...
23
		$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
34
		$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
24
 
35
 
Line 30... Line 41...
30
 
41
 
31
		return $this->getVue(Config::get('dossier_squelettes_formulaires').'identification',$donnees);
42
		return $this->getVue(Config::get('dossier_squelettes_formulaires').'identification',$donnees);
Line 32... Line 43...
32
	}
43
	}
-
 
44
 
33
 
45
	public function loggerUtilisateur($utilisateur, $pass) {
Line -... Line 46...
-
 
46
		
34
	public function loggerUtilisateur($utilisateur, $pass) {
47
		$this->objet_identification = Config::get('objet_identification');
Line 35... Line 48...
35
		$this->objet_identification = Config::get('objet_identification');
48
		
36
 
49
		// on cree le cookie
37
		$this->creerCookie($utilisateur, $pass);
50
		$this->creerCookie($utilisateur, $pass);
38
 
51
		
Line 39... Line 52...
39
		// Loguer l'utilisateur
52
		// On loggue l'utilisateur
40
		$this->objet_identification->username = $utilisateur;
53
		$this->objet_identification->username = $utilisateur;
Line 41... Line 54...
41
		$this->objet_identification->password = $pass;
54
		$this->objet_identification->password = $pass;
-
 
55
		$this->objet_identification->login();
42
		$this->objet_identification->login();
56
 
43
 
57
		return true;
-
 
58
	}
44
		return true;
59
	
45
	}
60
	public function deLoggerUtilisateur() {
Line 46... Line 61...
46
 
61
		
47
	public function deLoggerUtilisateur() {
62
		$this->objet_identification = Config::get('objet_identification');
48
		$this->objet_identification = Config::get('objet_identification');
63
		$this->objet_identification->logout();
49
		$this->objet_identification->logout();
64
		
50
		return true;
-
 
51
	}
65
		return true;
52
 
66
	}
Line 53... Line 67...
53
	public function setUtilisateur($nom_utilisateur) {
67
	
-
 
68
	public function setUtilisateur($nom_utilisateur) {
54
		$this->objet_identification = Config::get('objet_identification');
69
		$this->objet_identification = Config::get('objet_identification');
Line 55... Line 70...
55
		$this->objet_identification->setAuth($nom_utilisateur);
70
		$this->objet_identification->setAuth($nom_utilisateur);
56
		$pass = $this->objet_identification->password;
71
		$pass = $this->objet_identification->password;
57
 
-
 
58
		$this->creerCookie($nom_utilisateur, $pass, true);
-
 
59
	}
72
		$this->creerCookie($nom_utilisateur, $pass, true);
-
 
73
	}
60
 
74
	
-
 
75
	public function creerCookie($utilisateur, $pass, $pass_deja_crypte = false) {
-
 
76
		
-
 
77
		$this->objet_identification = Config::get('objet_identification');
61
	public function creerCookie($utilisateur, $pass, $pass_deja_crypte = false) {
78
		
62
		$this->objet_identification = Config::get('objet_identification');
79
		// Expiration si l'utilisateur ne referme pas son navigateur
63
 
80
		$this->objet_identification->setExpire(0);
Line 64... Line 81...
64
		// Expiration si l'utilisateur ne referme pas son navigateur
81
		// Création d'un cookie pour rendre permanente l'identification de Papyrus
65
		$this->objet_identification->setExpire(0);
-
 
Line 66... Line 82...
66
		$this->objet_identification->setIdle(0);
82
		if(!$pass_deja_crypte) {
-
 
83
			$pass_crypt = md5($pass); 
67
 
84
		} else {
68
		// Création d'un cookie pour rendre permanente l'identification de Papyrus
85
			$pass_crypt = $pass;
69
		$pass_crypt = (!$pass_deja_crypte) ? md5($pass) : $pass;
86
		}
70
		$cookie_val = $pass_crypt.$utilisateur;
87
		$cookie_val = $pass_crypt.$utilisateur;
71
		setcookie(session_name().'-memo', $cookie_val, 0, '/');
88
		setcookie(session_name().'-memo', $cookie_val, 0, '/');		
72
	}
89
	}
-
 
90
	
73
 
91
	public function obtenirLoginUtilisateurParCookie() {
74
	public function obtenirLoginUtilisateurParCookie() {
92
 
75
		$nom_session = Config::get('nom_session');
93
		$nom_utilisateur = Config::get('nom_utilisateur');
76
 
94