Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AuthController Class Reference
+ Inheritance diagram for AuthController:

Public Member Functions

 __construct ($instance=null)
 
 index ()
 Default action.
 
 isValid ($action)
 {Returns True if access to the controller is allowed To be override in sub classes.
Parameters
string$action
Returns
boolean
}
 
 noAccess ($urlParts)
 Action called when the user does not have access rights to a requested resource.
 
 connect ()
 Override to implement the complete connection procedure.
 
 badLogin ()
 Default Action for invalid creditentials.
 
 terminate ()
 Logout action Terminate the session and display a logout message.
 
 _disConnected ()
 
 info ($force=null)
 Action displaying the logged user information if _displayInfoAsString returns true, use _infoUser var in views to display user info.
 
 checkConnection ()
 
 _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> !".
 
 _setLoginCaption ($_loginCaption)
 
 _autoConnect ()
 Auto connect the user.
 
 forgetConnection ()
 Deletes the cookie for auto connection and returns to index.
 
 finalize ()
 {Method called after each action Can be override in derived class.}
 
 initialize ()
 {Method called before each action Can be override in derived class.}
 
 _forward ($url, $initialize=null, $finalize=null)
 
 _addAjaxBehavior (JsUtils $jquery=null, $ajaxParameters=['hasLoader'=> '$(this).children(".button")', 'historize'=>false, 'listenerOn'=> 'body'])
 
 _addFrmAjaxBehavior ($id)
 
 _init ()
 
- Public Member Functions inherited from Controller
 __construct ()
 Constructor initialize $view variable.
 
 loadView (string $viewName, $pData=null, bool $asString=false)
 Loads the view $viewName possibly passing the variables $pdata.
 
 loadDefaultView ($pData=null, bool $asString=false)
 Loads the default view (controllerName/actionName) possibly passing the variables $pdata.
 
 getDefaultViewName ()
 Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName If there is an activeTheme @activeTheme/ControllerName/actionName.html
 
 onInvalidControl ()
 Called if isValid () returns false To be override in sub classes.
 
 forward (string $controller, string $action='index', $params=[], bool $initialize=false, bool $finalize=false)
 Loads the controller $controller and calls its $action method by passing the parameters $params.
 
 redirectToRoute (string $routeName, $parameters=[], bool $initialize=false, bool $finalize=false)
 Redirect to a route by its name.
 
 getView ()
 Returns the associated view instance.
 
- Public Member Functions inherited from AuthControllerCoreTrait
 loadView (string $viewName, $pData=NULL, bool $asString=false)
 
 _getBodySelector ()
 
 _getBaseRoute ()
 
 _getLoginInputName ()
 
 message ($type, $header, $body, $icon='info', $id=null)
 
 newAccountCreationRule ()
 
- Public Member Functions inherited from AuthControllerVariablesTrait
 _displayInfoAsString ()
 Override to define if user info is displayed as string.
 
 _getUserSessionKey ()
 To override for defining user session key, default : "activeUser".
 
 _checkConnectionTimeout ()
 
 _getLoginInputName ()
 
 _getPasswordInputName ()
 
 _getBodySelector ()
 Returns the body selector (jquery selector used for replacing the content of the page).
 
- Public Member Functions inherited from AuthControllerOverrideTrait
 _getUserSessionKey ()
 
 _getBaseRoute ()
 To override Return the base route for this Auth controller.
 
 _getActiveUser ()
 To override for getting active user, default : USession::get("activeUser")
 
 _isValidUser ($action=null)
 Checks if user is valid for the action.
 
- Public Member Functions inherited from InsertJqueryTrait
 _insertJquerySemantic ()
 
- Public Member Functions inherited from Auth2FATrait
 _getBodySelector ()
 
 _getUserSessionKey ()
 
 bad2FACode ()
 @noRoute
 
 confirm ()
 @noRoute
 
 submitCode ()
 Submits the 2FA code in post request.
 
 sendNew2FACode ()
 

Protected Member Functions

 finalizeAuth ()
 
 initializeAuth ()
 
- Protected Member Functions inherited from AuthControllerCoreTrait
 attemptsTimeout ()
 
 getFiles ()
 
 _newAccountCreationRule (string $accountName)
 
 hasAccountCreation ()
 
 hasAccountRecovery ()
 
 canCreateAccountMessage (FlashMessage $fMessage)
 
 getAccountRecoveryLink ()
 
 getBaseUrl ()
 
 useAjax ()
 
 fMessage (FlashMessage $fMessage, $id=null)
 
 noAttempts ()
 
 authLoadView ($viewName, $vars=[])
 
 getOriginalURL ()
 
 _getFiles ()
 
 getViewVars ($viewname)
 
 addAccountCreationViewData (array &$vData, $forMessage=false)
 
- Protected Member Functions inherited from AuthControllerVariablesTrait
 noAccessMessage (FlashMessage $fMessage)
 Override for modifying the noAccess message.
 
 attemptsNumberMessage (FlashMessage $fMessage, $attempsCount)
 Override for modifying attempts message You can use {_timer} and {_attemptsCount} variables in message content.
 
 badLoginMessage (FlashMessage $fMessage)
 To override for modifying the bad login message.
 
 terminateMessage (FlashMessage $fMessage)
 To override for modifying the logout message.
 
 disconnectedMessage (FlashMessage $fMessage)
 To override for modifying the disconnect message.
 
 attemptsNumber ()
 To override Returns int the maximum number of allowed login attempts.
 
 attemptsTimeout ()
 To override Returns the time before trying to connect again Effective only if attemptsNumber return a number.
 
 loginLabel ()
 
 passwordLabel ()
 
 passwordConfLabel ()
 
 rememberCaption ()
 
- Protected Member Functions inherited from AuthControllerOverrideTrait
 _connect ()
 Processes the data posted by the login form Have to return the connected user instance.
 
 onConnect ($connected)
 
 onBadCreditentials ()
 To override for defining a new action when creditentials are invalid.
 
 toCookie ($connected)
 Returns the value from connected user to save it in the cookie for auto connection.
 
 fromCookie ($cookie)
 Loads the user from database using the cookie value.
 
 rememberMe ($connected)
 Saves the connected user identifier in a cookie.
 
 getCookieUser ()
 Returns the cookie for auto connection.
 
 getFiles ()
 To override for changing view files.
 
- Protected Member Functions inherited from Auth2FATrait
 fMessage (FlashMessage $fMessage, $id=null)
 
 _getFiles ()
 
 getBaseUrl ()
 
 authLoadView ($viewName, $vars=[])
 
 useAjax ()
 
 onConnect ($connected)
 
 has2FA ($accountValue=null)
 To override Returns true for a two factor authentification for this account.
 
 onBad2FACode ()
 To override for defining a new action when 2FA code is invalid.
 
 _send2FACode (string $code, $connected)
 To override Send the 2FA code to the user (email, sms, phone call...)
 
 getTokenSize ()
 To override Returns the default size for generated tokens.
 
 generate2FACode ()
 Generates a new random 2FA code.
 
 towFACodePrefix ()
 Returns the code prefix (which should not be entered by the user).
 
 twoFACodeDuration ()
 Returns the default validity duration of a generated 2FA code.
 
 twoFAMessage (FlashMessage $fMessage)
 To override for modifying the 2FA panel message.
 
 newTwoFACodeMessage (FlashMessage $fMessage)
 To override.
 
 twoFABadCodeMessage (FlashMessage $fMessage)
 To override for modifying the message displayed if the 2FA code is bad.
 
 check2FACode (string $secret, string $userInput)
 To override for a more secure 2FA code.
 
 save2FACode ()
 
 send2FACode ()
 

Protected Attributes

 $authFiles
 
 $_controller
 
 $_action
 
 $_actionParams
 
 $_noAccessMsg
 
 $_loginCaption
 
 $_attemptsSessionKey = '_attempts'
 
 $_controllerInstance
 
 $_compileJS = true
 
 $_invalid =false
 
- Protected Attributes inherited from Controller
View $view
 

Additional Inherited Members

- Data Fields inherited from InsertJqueryTrait
 $jquery
 

Detailed Description

Definition at line 26 of file AuthController.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $instance = null)

Definition at line 43 of file AuthController.php.

Member Function Documentation

◆ _addAjaxBehavior()

_addAjaxBehavior ( JsUtils  $jquery = null,
  $ajaxParameters = ['hasLoader'=>'$(this).children(".button")','historize'=>false,'listenerOn'=>'body'] 
)

Definition at line 311 of file AuthController.php.

◆ _addFrmAjaxBehavior()

_addFrmAjaxBehavior (   $id)

Reimplemented from AuthAccountCreationTrait.

Definition at line 317 of file AuthController.php.

◆ _autoConnect()

_autoConnect ( )

Auto connect the user.

Definition at line 239 of file AuthController.php.

◆ _disConnected()

_disConnected ( )

Definition at line 184 of file AuthController.php.

◆ _forward()

_forward (   $url,
  $initialize = null,
  $finalize = null 
)
Parameters
string$url

Definition at line 301 of file AuthController.php.

◆ _init()

_init ( )

Reimplemented in AuthControllerConfig.

Definition at line 324 of file AuthController.php.

◆ _setLoginCaption()

_setLoginCaption (   $_loginCaption)
Parameters
string$_loginCaption

Definition at line 232 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 224 of file AuthController.php.

◆ badLogin()

badLogin ( )

Default Action for invalid creditentials.

@noRoute()

Reimplemented from AuthControllerOverrideTrait.

Definition at line 147 of file AuthController.php.

◆ checkConnection()

checkConnection ( )

Definition at line 210 of file AuthController.php.

◆ connect()

connect ( )

Override to implement the complete connection procedure.

Postcondition

Definition at line 114 of file AuthController.php.

◆ finalize()

finalize ( )

{Method called after each action Can be override in derived class.}

See also
\Ubiquity\controllers\ControllerBase::finalize()

Reimplemented from Controller.

Definition at line 262 of file AuthController.php.

◆ finalizeAuth()

finalizeAuth ( )
protected

Reimplemented from Auth2FATrait.

Definition at line 274 of file AuthController.php.

◆ forgetConnection()

forgetConnection ( )

Deletes the cookie for auto connection and returns to index.

Definition at line 252 of file AuthController.php.

◆ index()

index ( )

Default action.

Reimplemented from Controller.

Definition at line 60 of file AuthController.php.

◆ info()

info (   $force = null)

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

Parameters
null | boolean$force
Returns
string|null
Exceptions

Exception

Reimplemented from AuthAccountRecoveryTrait.

Definition at line 201 of file AuthController.php.

◆ initialize()

initialize ( )

{Method called before each action Can be override in derived class.}

See also
\Ubiquity\controllers\ControllerBase::initialize()

Reimplemented from Controller.

Reimplemented in AuthControllerConfig.

Definition at line 285 of file AuthController.php.

◆ initializeAuth()

initializeAuth ( )
protected

Reimplemented from Auth2FATrait.

Definition at line 291 of file AuthController.php.

◆ isValid()

isValid (   $action)
final

{Returns True if access to the controller is allowed To be override in sub classes.

Parameters
string$action
Returns
boolean
}

See also
\Ubiquity\controllers\Controller::isValid()

Reimplemented from Controller.

Definition at line 81 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 90 of file AuthController.php.

◆ terminate()

terminate ( )

Logout action Terminate the session and display a logout message.

Definition at line 176 of file AuthController.php.

Field Documentation

◆ $_action

$_action
protected

Definition at line 34 of file AuthController.php.

◆ $_actionParams

$_actionParams
protected

Definition at line 35 of file AuthController.php.

◆ $_attemptsSessionKey

$_attemptsSessionKey = '_attempts'
protected

Definition at line 38 of file AuthController.php.

◆ $_compileJS

$_compileJS = true
protected

Definition at line 40 of file AuthController.php.

◆ $_controller

$_controller
protected

Definition at line 33 of file AuthController.php.

◆ $_controllerInstance

$_controllerInstance
protected

Definition at line 39 of file AuthController.php.

◆ $_invalid

$_invalid =false
protected

Definition at line 41 of file AuthController.php.

◆ $_loginCaption

$_loginCaption
protected

Definition at line 37 of file AuthController.php.

◆ $_noAccessMsg

$_noAccessMsg
protected

Definition at line 36 of file AuthController.php.

◆ $authFiles

$authFiles
protected

Definition at line 32 of file AuthController.php.


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