vB_Library_Login
extends vB_Library
in package
vB_Library_Login
Tags
Table of Contents
- $instance : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- clearCache() : mixed
- getContentInstance() : mixed
- importPasswordSchemes() : mixed
- Load the scheme files from xml files
- instance() : vB_PageCache
- Returns singleton instance of self.
- monitorWords() : mixed
- Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
- resetMfaSecret() : mixed
- setMfaEnabled() : mixed
- setPassword() : no
- Change the password for a user
- verifyMfa() : mixed
- Check the Verification Code entered by the user.
- verifyPasswordFromInfo() : mixed
- Verify a login value
- verifyRememberMeFromInfo() : array<string|int, mixed>
- Verify the remember token.
- __construct() : mixed
- checkPasswordHistory() : bool
- Checks to see if a password is in the user's password history
- generateRememberMeToken() : mixed
- getLibraryClassNameInternal() : mixed
- getSchemesByPriority() : mixed
- processPasswordSchemes() : mixed
- readPasswordSchemes() : array<string|int, mixed>
- Fetch the scheme files from disk and returned the parsed arrays
- updatePasswordHistory() : mixed
- Inserts a record into the password history table if the user's password has changed
- verifyMd5() : mixed
- Verify that a string value is an md5 hash
- encodePassword() : mixed
- Encode the password
- getTopScheme() : mixed
Properties
$instance
protected
static mixed
$instance
= array()
Methods
__serialize()
public
__serialize() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —__unserialize()
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —clearCache()
public
static clearCache() : mixed
Return values
mixed —getContentInstance()
public
static getContentInstance(mixed $contenttypeid) : mixed
Parameters
- $contenttypeid : mixed
Return values
mixed —importPasswordSchemes()
Load the scheme files from xml files
public
importPasswordSchemes() : mixed
Return values
mixed —instance()
Returns singleton instance of self.
public
static instance(mixed $class) : vB_PageCache
Parameters
- $class : mixed
Return values
vB_PageCache —- Reference to singleton instance of the cache handler
monitorWords()
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
public
monitorWords(mixed $text, mixed $type, mixed $nodeid[, mixed $userid = null ][, mixed $insertNotifications = true ], mixed $currentuserid) : mixed
Parameters
- $text : mixed
- $type : mixed
- $nodeid : mixed
- $userid : mixed = null
- $insertNotifications : mixed = true
- $currentuserid : mixed
Return values
mixed —resetMfaSecret()
public
resetMfaSecret(mixed $userid) : mixed
Parameters
- $userid : mixed
Return values
mixed —setMfaEnabled()
public
setMfaEnabled(mixed $userid, mixed $enabled) : mixed
Parameters
- $userid : mixed
- $enabled : mixed
Return values
mixed —setPassword()
Change the password for a user
public
setPassword(int $userid, string $password, array<string|int, mixed> $checkOptions[, array<string|int, mixed> $checkOverrides = [] ]) : no
Parameters
- $userid : int
-
-- the id of the user to change the passwordor
- $password : string
-
-- the passsword to use for the new hash. May be md5 encoded.
- $checkOptions : array<string|int, mixed>
-
-- values for permission checks. These are all required (though they might be ignored if the specific check is skipped).
- passwordhistorylength -- The number of days to look back for duplicate passwords
- $checkOverrides : array<string|int, mixed> = []
-
-- checks to skip. This will usually be based on user permissions, but we shouldn't check those in the library. All of these fields are optional. If not set or set to false, the check will be performed. If set to true, then the check will be skipped.
- passwordbadwords -- skip the check for bad passwords
- passwordhistory -- skip the check for the password history for this user. Will will still store the password set in the history
- passwordrules -- skip the checks for the various password requirement rules that are configurable
- all -- as special value that will skip all of the checks.
Note that these checks should not be skipped lightly and this option mostly exists so that we can rehash passwords that were validated against previous rules and might fail against new rules in a context where we can't handle the errors.
Tags
Return values
no —return. Will throw an exception if setting the password fails.
verifyMfa()
Check the Verification Code entered by the user.
public
verifyMfa(mixed $secretkey, mixed $thistry, mixed $relaxedmode) : mixed
Parameters
- $secretkey : mixed
- $thistry : mixed
- $relaxedmode : mixed
Return values
mixed —verifyPasswordFromInfo()
Verify a login value
public
verifyPasswordFromInfo(array<string|int, mixed> $login, mixed $passwords) : mixed
In addition to the user's password, we'll verify do a couple of additional things
- If the password hash scheme is disabled, we'll reject the login entirely
- If the scheme is not current, we will attempt to quietly rehash
- If the scheme has been deprecated and we cannot rehash, then we'll expire the password.
Parameters
- $login : array<string|int, mixed>
-
The login info of the user to verify containg * token -- the password hash to verify against * scheme -- the scheme used to generate the hash @param $passwords array. Array of password variants in the form array('password' => $password, 'encoding' => $encoding) valid values for encoding are 'text' and 'md5'. This is required to handle various legacy logic that encodes the password using md5 on the front end. We may wish to expand that to include better front end encodings in the future. @return array * auth bool true if the login succeeded, false otherwise * remembermetoken string token to use for remember me logic (blank if not authenticated)
- $passwords : mixed
Return values
mixed —verifyRememberMeFromInfo()
Verify the remember token.
public
verifyRememberMeFromInfo(array<string|int, mixed> $login, string $remembermetoken) : array<string|int, mixed>
This verifies if the "rememberme" token returned by the password verification function is valid for the given user
Parameters
- $login : array<string|int, mixed>
-
login information
- token -- the user's password token
- scheme -- the user's password scheme
- $remembermetoken : string
-
-- The token to checka
Return values
array<string|int, mixed> —- auth (boolean) -- true if the rememberme token matches, false otherwise
- remembermetoken (string) -- the "current" rememberme token. This will be the same as the rememberme token passed in unless we validated based on a legacy value. This should be used to update the rememberme value stored with the client. If the auth failed, this will be blank.
__construct()
protected
__construct() : mixed
Return values
mixed —checkPasswordHistory()
Checks to see if a password is in the user's password history
protected
checkPasswordHistory(int $userid, string $fe_password, int $lookback) : bool
Will also delete any expired records in the password history.
Parameters
- $userid : int
-
User ID
- $fe_password : string
-
-- the frontend encoded password
- $lookback : int
-
The time period to look back for passwords in seconds
Return values
bool —Returns true if password is in the history
generateRememberMeToken()
protected
generateRememberMeToken(mixed $passwordtoken, mixed $salt) : mixed
Parameters
- $passwordtoken : mixed
- $salt : mixed
Return values
mixed —getLibraryClassNameInternal()
protected
static getLibraryClassNameInternal(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —getSchemesByPriority()
protected
getSchemesByPriority(mixed $schemeArray) : mixed
Parameters
- $schemeArray : mixed
Return values
mixed —processPasswordSchemes()
protected
processPasswordSchemes(mixed $schemeArrays) : mixed
Parameters
- $schemeArrays : mixed
Return values
mixed —readPasswordSchemes()
Fetch the scheme files from disk and returned the parsed arrays
protected
readPasswordSchemes(string $xmldir) : array<string|int, mixed>
Parameters
- $xmldir : string
-
the directory the xml files are located in
Return values
array<string|int, mixed> —the password scheme data in the form array ('scheme' => array('priority' => $n)) Note that the scheme is an array for potential future expansion.
updatePasswordHistory()
Inserts a record into the password history table if the user's password has changed
protected
updatePasswordHistory(mixed $userid, mixed $data) : mixed
Parameters
- $userid : mixed
- $data : mixed
Return values
mixed —verifyMd5()
Verify that a string value is an md5 hash
protected
verifyMd5(string &$md5) : mixed
Parameters
- $md5 : string
-
-- string to check for an md5 hash.
Return values
mixed —encodePassword()
Encode the password
private
encodePassword(mixed $password) : mixed
The browswer will (if JS is enabled) encode the password as an md5hash before sending to the server on login. Previous versions did this when setting the password. This is an attempt to get the password into a consistant form before hashing it with the main password hash.
Otherwise we can get situations where the hash we save doesn't match the hash we entered for one reason or another.
Parameters
- $password : mixed
Return values
mixed —getTopScheme()
private
getTopScheme(mixed $schemes) : mixed
Parameters
- $schemes : mixed