Ubiquity  2.0.3
php rapid development framework
AuthController Class Reference
+ Inheritance diagram for AuthController:

Public Member Functions

 __construct ()
 
 index ()
 
 _getBaseRoute ()
 To override Return the base route for this Auth controller. More...
 
 isValid ($action)
 
 noAccess ($urlParts)
 Action called when the user does not have access rights to a requested resource. More...
 
 connect ()
 Override to implement the complete connection procedure. More...
 
 badLogin ()
 Default Action for invalid creditentials. More...
 
 terminate ()
 Logout action Terminate the session and display a logout message. More...
 
 _disConnected ()
 
 info ()
 Action displaying the logged user information if _displayInfoAsString returns true, use _infoUser var in views to display user info. More...
 
 message ($type, $header, $body, $icon="info", $id=null)
 
 _getUserSessionKey ()
 To override for defining user session key, default : "activeUser". More...
 
 _getActiveUser ()
 To override for getting active user, default : USession::get("activeUser") More...
 
 _checkConnection ()
 
 _isValidUser ()
 return boolean true if activeUser is valid More...
 
 _displayInfoAsString ()
 Override to define if info is displayed as string if set to true, use _infoUser var in views to display user info. More...
 
 _checkConnectionTimeout ()
 
 _getLoginInputName ()
 
 _getPasswordInputName ()
 
 _getBodySelector ()
 
 _setNoAccessMsg ($content, $title=NULL, $type=NULL, $icon=null)
 Sets the default noAccess message Default : "You are not authorized to access the page <b>{url}</b> !". More...
 
 _setLoginCaption ($_loginCaption)
 
 _autoConnect ()
 Auto connect the user. More...
 
 forgetConnection ()
 Deletes the cookie for auto connection and returns to index. More...
 
- Public Member Functions inherited from ControllerBase
 initialize ()
 
 finalize ()
 
- Public Member Functions inherited from Controller
 index ()
 Default action. More...
 
 __construct ()
 Constructor initialize $view variable. More...
 
 initialize ()
 Method called before each action Can be override in derived class. More...
 
 finalize ()
 Method called after each action Can be override in derived class. More...
 
 loadView ($viewName, $pData=NULL, $asString=false)
 Loads the view $viewName possibly passing the variables $pdata. More...
 
 loadDefaultView ($pData=NULL, $asString=false)
 Loads the default view (controllerName/actionName) possibly passing the variables $pdata. More...
 
 getDefaultViewName ()
 Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName. More...
 
 isValid ($action)
 Returns True if access to the controller is allowed To be override in sub classes. More...
 
 onInvalidControl ()
 Called if isValid () returns false
To be override in sub classes. More...
 
 forward ($controller, $action="index", $params=array(), $initialize=false, $finalize=false)
 Loads the controller $controller and calls its $action method by passing the parameters $params. More...
 
 redirectToRoute ($routeName, $parameters=[], $initialize=false, $finalize=false)
 Redirect to a route by its name. More...
 
 getView ()
 

Protected Member Functions

 noAccessMessage (FlashMessage $fMessage)
 Override for modifying the noAccess message. More...
 
 attemptsNumberMessage (FlashMessage $fMessage, $attempsCount)
 Override for modifying attempts message You can use {_timer} and {_attemptsCount} variables in message content. More...
 
 _connect ()
 Processes the data posted by the login form Have to return the connected user instance. More...
 
 onConnect ($connected)
 
 onBadCreditentials ()
 To override for defining a new action when creditentials are invalid. More...
 
 noAttempts ()
 
 badLoginMessage (FlashMessage $fMessage)
 To override for modifying the bad login message. More...
 
 terminateMessage (FlashMessage $fMessage)
 To override for modifying the logout message. More...
 
 disconnectedMessage (FlashMessage $fMessage)
 To override for modifying the disconnect message. More...
 
 fMessage (FlashMessage $fMessage, $id=null)
 
 getOriginalURL ()
 
 attemptsNumber ()
 To override Returns the maximum number of allowed login attempts. More...
 
 attemptsTimeout ()
 To override Returns the time before trying to connect again Effective only if attemptsNumber return a number. More...
 
 getFiles ()
 To override for changing view files. More...
 
 loginLabel ()
 
 passwordLabel ()
 
 rememberCaption ()
 
 getViewVars ($viewname)
 
 rememberMe ($connected)
 Saves the connected user identifier in a cookie. More...
 
 getCookieUser ()
 Returns the cookie for auto connection. More...
 
 toCookie ($connected)
 Returns the value from connected user to save it in the cookie for auto connection. More...
 
 fromCookie ($cookie)
 Loads the user from database using the cookie value. More...
 

Protected Attributes

 $authFiles
 
 $_controller
 
 $_action
 
 $_actionParams
 
 $_noAccessMsg
 
 $_loginCaption
 
 $_attemptsSessionKey ="_attempts"
 
- Protected Attributes inherited from ControllerBase
 $headerView ="@framework/main/vHeader.html"
 
 $footerView ="@framework/main/vFooter.html"
 
- Protected Attributes inherited from Controller
 $view
 

Private Member Functions

 authLoadView ($viewName, $vars=[])
 
 _getFiles ()
 

Detailed Description

Definition at line 19 of file AuthController.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 31 of file AuthController.php.

Member Function Documentation

◆ _autoConnect()

_autoConnect ( )

Auto connect the user.

Definition at line 422 of file AuthController.php.

◆ _checkConnection()

_checkConnection ( )

Definition at line 301 of file AuthController.php.

◆ _checkConnectionTimeout()

_checkConnectionTimeout ( )

Definition at line 327 of file AuthController.php.

◆ _connect()

_connect ( )
abstractprotected

Processes the data posted by the login form Have to return the connected user instance.

◆ _disConnected()

_disConnected ( )

Definition at line 221 of file AuthController.php.

◆ _displayInfoAsString()

_displayInfoAsString ( )

Override to define if info is displayed as string if set to true, use _infoUser var in views to display user info.

Definition at line 323 of file AuthController.php.

◆ _getActiveUser()

_getActiveUser ( )

To override for getting active user, default : USession::get("activeUser")

Returns
string

Definition at line 279 of file AuthController.php.

◆ _getBaseRoute()

_getBaseRoute ( )

To override Return the base route for this Auth controller.

Returns
string

Definition at line 60 of file AuthController.php.

◆ _getBodySelector()

_getBodySelector ( )

Definition at line 354 of file AuthController.php.

◆ _getFiles()

_getFiles ( )
private

Definition at line 331 of file AuthController.php.

◆ _getLoginInputName()

_getLoginInputName ( )

Definition at line 338 of file AuthController.php.

◆ _getPasswordInputName()

_getPasswordInputName ( )

Definition at line 346 of file AuthController.php.

◆ _getUserSessionKey()

_getUserSessionKey ( )

To override for defining user session key, default : "activeUser".

Returns
string

Definition at line 271 of file AuthController.php.

◆ _isValidUser()

_isValidUser ( )
abstract

return boolean true if activeUser is valid

◆ _setLoginCaption()

_setLoginCaption (   $_loginCaption)
Parameters
string$_loginCaption

Definition at line 372 of file AuthController.php.

◆ _setNoAccessMsg()

_setNoAccessMsg (   $content,
  $title = NULL,
  $type = NULL,
  $icon = null 
)

Sets the default noAccess message Default : "You are not authorized to access the page <b>{url}</b> !".

Parameters
string$content
string$title
string$type
string$icon

Definition at line 366 of file AuthController.php.

◆ attemptsNumber()

attemptsNumber ( )
protected

To override Returns the maximum number of allowed login attempts.

Definition at line 287 of file AuthController.php.

◆ attemptsNumberMessage()

attemptsNumberMessage ( FlashMessage  $fMessage,
  $attempsCount 
)
protected

Override for modifying attempts message You can use {_timer} and {_attemptsCount} variables in message content.

Parameters
FlashMessage$fMessage
int$attempsCount

Definition at line 100 of file AuthController.php.

◆ attemptsTimeout()

attemptsTimeout ( )
protected

To override Returns the time before trying to connect again Effective only if attemptsNumber return a number.

Returns
number

Definition at line 297 of file AuthController.php.

◆ authLoadView()

authLoadView (   $viewName,
  $vars = [] 
)
private

Definition at line 197 of file AuthController.php.

◆ badLogin()

badLogin ( )

Default Action for invalid creditentials.

Definition at line 144 of file AuthController.php.

◆ badLoginMessage()

badLoginMessage ( FlashMessage  $fMessage)
protected

To override for modifying the bad login message.

Parameters
FlashMessage$fMessage

Definition at line 193 of file AuthController.php.

◆ connect()

connect ( )

Override to implement the complete connection procedure.

Definition at line 107 of file AuthController.php.

◆ disconnectedMessage()

disconnectedMessage ( FlashMessage  $fMessage)
protected

To override for modifying the disconnect message.

Parameters
FlashMessage$fMessage

Definition at line 242 of file AuthController.php.

◆ fMessage()

fMessage ( FlashMessage  $fMessage,
  $id = null 
)
protected

Definition at line 255 of file AuthController.php.

◆ forgetConnection()

forgetConnection ( )

Deletes the cookie for auto connection and returns to index.

Definition at line 434 of file AuthController.php.

◆ fromCookie()

fromCookie (   $cookie)
protected

Loads the user from database using the cookie value.

Parameters
string$cookie

Definition at line 415 of file AuthController.php.

◆ getCookieUser()

getCookieUser ( )
protected

Returns the cookie for auto connection.

Returns
NULL|string

Definition at line 399 of file AuthController.php.

◆ getFiles()

getFiles ( )
protected

To override for changing view files.

Returns
AuthFiles

Definition at line 315 of file AuthController.php.

◆ getOriginalURL()

getOriginalURL ( )
protected

Definition at line 263 of file AuthController.php.

◆ getViewVars()

getViewVars (   $viewname)
protected

Definition at line 380 of file AuthController.php.

◆ index()

index ( )

Definition at line 40 of file AuthController.php.

◆ info()

info ( )

Action displaying the logged user information if _displayInfoAsString returns true, use _infoUser var in views to display user info.

Returns
string|null

Definition at line 251 of file AuthController.php.

◆ isValid()

isValid (   $action)
final

See also
::isValid()

Definition at line 67 of file AuthController.php.

◆ loginLabel()

loginLabel ( )
protected

Definition at line 342 of file AuthController.php.

◆ message()

message (   $type,
  $header,
  $body,
  $icon = "info",
  $id = null 
)

Definition at line 259 of file AuthController.php.

◆ noAccess()

noAccess (   $urlParts)

Action called when the user does not have access rights to a requested resource.

Parameters
array | string$urlParts

Definition at line 75 of file AuthController.php.

◆ noAccessMessage()

noAccessMessage ( FlashMessage  $fMessage)
protected

Override for modifying the noAccess message.

Parameters
FlashMessage$fMessage

Definition at line 90 of file AuthController.php.

◆ noAttempts()

noAttempts ( )
protected

Definition at line 167 of file AuthController.php.

◆ onBadCreditentials()

onBadCreditentials ( )
protected

To override for defining a new action when creditentials are invalid.

Definition at line 137 of file AuthController.php.

◆ onConnect()

onConnect (   $connected)
abstractprotected
Parameters
object$connected

◆ passwordLabel()

passwordLabel ( )
protected

Definition at line 350 of file AuthController.php.

◆ rememberCaption()

rememberCaption ( )
protected

Definition at line 376 of file AuthController.php.

◆ rememberMe()

rememberMe (   $connected)
protected

Saves the connected user identifier in a cookie.

Parameters
object$connected

Definition at line 388 of file AuthController.php.

◆ terminate()

terminate ( )

Logout action Terminate the session and display a logout message.

Definition at line 213 of file AuthController.php.

◆ terminateMessage()

terminateMessage ( FlashMessage  $fMessage)
protected

To override for modifying the logout message.

Parameters
FlashMessage$fMessage

Definition at line 234 of file AuthController.php.

◆ toCookie()

toCookie (   $connected)
protected

Returns the value from connected user to save it in the cookie for auto connection.

Parameters
object$connected

Definition at line 407 of file AuthController.php.

Field Documentation

◆ $_action

$_action
protected

Definition at line 25 of file AuthController.php.

◆ $_actionParams

$_actionParams
protected

Definition at line 26 of file AuthController.php.

◆ $_attemptsSessionKey

$_attemptsSessionKey ="_attempts"
protected

Definition at line 29 of file AuthController.php.

◆ $_controller

$_controller
protected

Definition at line 24 of file AuthController.php.

◆ $_loginCaption

$_loginCaption
protected

Definition at line 28 of file AuthController.php.

◆ $_noAccessMsg

$_noAccessMsg
protected

Definition at line 27 of file AuthController.php.

◆ $authFiles

$authFiles
protected

Definition at line 23 of file AuthController.php.


The documentation for this class was generated from the following file: