Interface to describe main user functionallities.
This interface describes the main methods an user calss
has to implement. It will be implemented in an abstract
class, which will implement main features and should be
used if you start implementing your own user class.
Methods
Checks given password $sNewPassword is complex enough.
checkPasswordMask(string $sNewPassword) : int
This method should check everything the user has to do to
have a "valid" password. Such a check can be "User has to use
symbols in password, but not as first sign."
Parameters
$sNewPassword
string
Returns
int
Checks given password $sNewPassword has a valid strength.
checkPasswordStrength(string $sNewPassword) : int
Parameters
$sNewPassword
string
Returns
int
Encodes the password $sPassword.
encodePassword(string $sPassword) : string
Static
You should use one-way
encodings or hash-algorithms to ensure that nobody can
read simply the passwords!
Parameters
$sPassword
string
Returns
string
Simple error messages, depending on error code $iErrorCode.
getErrorString(int $iErrorCode, array $aCfg) : string
Static
Parameters
$iErrorCode
int
$aCfg
array
Contenido configuration array
Returns
string
Loads data for user $sUserId.
load(string $sUserId)
Parameters
$sUserId
string
This method tries to save all information collected for an user.
save() : boolean
If everything is fine, it returns true - otherwise false. On fatal
errors a ConUserException will be thrown.
Returns
boolean
This method saves the given password $sNewPassword.
savePassword(string $sNewPassword)
The password
has to be checked, before it is set to the database. The resulting
integer value represents the result code.
Use the PASS_* constants to check what happens.
Parameters
$sNewPassword
string
Constants
Exception code, which is used if an password is set to save
that is not valid.
EXCEPTION_PASSWORD_INVALID : int
Exception code, which is used if you try to add an user
that already exists.
EXCEPTION_USERNAME_EXISTS : int
This value will be used if no minimum length
for passwords are set via $cfg['password']['min_length']
MIN_PASS_LENGTH_DEFAULT
Given password is not complex enough
PASS_NOT_COMPLEX : int
Password does not contain enough different characters.
PASS_NOT_ENOUGH_DIFFERENT_CHARS : int
Password does not contain enough mixed characters.
PASS_NOT_ENOUGH_MIXED_CHARS : int
Password does not contain enough numbers.
PASS_NOT_ENOUGH_NUMBERS : int
Password does not contain enough symbols.
PASS_NOT_ENOUGH_SYMBOLS : int
Given password is not strong enough
PASS_NOT_STRONG : int
Password is ok and stored.
PASS_OK : int
Given password is to short
PASS_TO_SHORT : int