This is the main class for authentification process
| package |
jelix |
|---|---|
| subpackage |
auth |
_getConfig()
| deprecated | |
|---|---|
| see | \jAuth::getConfig() |
changePassword(string $login, string $newpassword) : boolean
stringthe login of the user
stringthe new password (not encrypted)
booleantrue if the change succeed
checkCookieToken()
createUserObject(string $login, string $password) : object
You should call this method if you want to create a new user. It returns an object, representing a user. Then you should fill its properties and give it to the saveNewUser method.
| since | 1.0b2 |
|---|
stringthe user login
stringthe user password (not encrypted)
objectthe returned object depends on the driver
generateCookieToken( $login, $password)
getDriver() : \jIAuthDriver
getDriverParam(string $paramName) : string
string
stringthe value. null if it doesn't exist
getRandomPassword(integer $length = 10, boolean $withoutSpecialChars = false) : string
integerthe length of the generated password
boolean(optional, default false) the generated password may be use this characters : !@#$%^&*?_,~
stringthe generated password
getUser(string $login) : object
This method returns an object, generated by the driver, and which contains data corresponding to the given login. This method should be called if you want to update data of a user. see updateUser method.
string
objectthe user
getUserList(string $pattern = '%') : array
string'' for all users
arrayarray of object
getUserSession() : object
objectthe user data
isConnected() : boolean
boolean
isPersistant() : boolean
booleantrue if persistant session in enabled
loadConfig(null $newconfig = null) : array
| since | 1.2.10 |
|---|---|
| Throws |
|
null
array
login(string $login, string $password, boolean $persistant = false) : boolean
stringthe login of the user
stringthe password to test (not encrypted)
boolean(optional) the session must be persistant
booleantrue if authentification is ok
logout()
removeUser(string $login) : boolean
stringthe user login
booleantrue if ok
saveNewUser(object $user) : object
if the saving has succeed, a AuthNewUser event is sent The given object should have been created by calling createUserObject method :
example :
$user = jAuth::createUserObject('login','password');
$user->email ='bla@foo.com';
jAuth::saveNewUser($user);
the type of $user depends of the driver, so it can have other properties.
objectthe user data
objectthe user (eventually, with additional data)
updateUser(object $user) : boolean
It send a AuthUpdateUser event if the saving has succeed. If you want to change the user password, you must use jAuth::changePassword method instead of jAuth::updateUser method.
The given object should have been created by calling getUser method. Example :
$user = jAuth::getUser('login');
$user->email ='bla@foo.com';
jAuth::updateUser($user);
the type of $user depends of the driver, so it can have other properties.
objectuser data
booleantrue if the user has been updated
verifyPassword(string $login, string $password) : object|false
stringthe login of the user
stringthe password to test (not encrypted)
object|falseif ok, returns the user as object
config :