Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AuthControllerOverrideTrait.php
Go to the documentation of this file.
1<?php
2
4
8
14
15 abstract public function badLogin();
16
17 abstract public function _getUserSessionKey():string;
18
24 public function _getBaseRoute(): string {
25 return ClassUtils::getClassSimpleName(\get_class($this));
26 }
27
32 abstract protected function _connect();
33
37 abstract protected function onConnect($connected);
38
42 protected function onBadCreditentials(){
43 $this->badLogin();
44 }
45
46
51 public function _getActiveUser(){
52 return USession::get($this->_getUserSessionKey());
53 }
54
60 abstract public function _isValidUser($action=null):bool;
61
66 protected function toCookie($connected){
67 return;
68 }
69
74 protected function fromCookie($cookie){
75 return;
76 }
77
78
83 protected function rememberMe($connected){
84 $id= $this->toCookie($connected);
85 if(isset($id)){
86 UCookie::set($this->_getUserSessionKey(),$id);
87 }
88 }
89
94 protected function getCookieUser(){
95 return UCookie::get($this->_getUserSessionKey());
96 }
97
102 protected function getFiles ():AuthFiles{
103 return new AuthFiles();
104 }
105
106}
107
Manipulates class and namespace names Ubiquity\cache$ClassUtils This class is part of Ubiquity.
_connect()
Processes the data posted by the login form Have to return the connected user instance.
_getActiveUser()
To override for getting active user, default : USession::get("activeUser")
rememberMe($connected)
Saves the connected user identifier in a cookie.
onBadCreditentials()
To override for defining a new action when creditentials are invalid.
_isValidUser($action=null)
Checks if user is valid for the action.
fromCookie($cookie)
Loads the user from database using the cookie value.
toCookie($connected)
Returns the value from connected user to save it in the cookie for auto connection.
_getBaseRoute()
To override Return the base route for this Auth controller.
Ubiquity\controllers\auth$AuthFiles This class is part of Ubiquity.
Definition AuthFiles.php:13
Http Session utilities This class is part of Ubiquity.
Definition USession.php:16