Password
class Password implements Viewable
ViewModel for changing the administrative password.
Traits
Methods
URL-encode and escape a query string for use in a URL.
Check that a string is comprised solely of alphanumeric characters.
Check that a string is comprised solely of alphanumeric characters and underscores.
Check that a string is comprised solely of alphabetical characters.
Cast to string, check UTF-8 encoding and strip trailing whitespace and control characters.
Validate a cross-site request forgery token from a form submission.
Constructor
Display the change password form.
Display change password confirmation message (success or failure).
Return the backUrl.
Set password confirmation.
Set password.
Return the response message (success or failure) for an action.
Details
in ValidateString at line 41
string
encodeEscapeUrl(string $url)
URL-encode and escape a query string for use in a URL.
Trims, checks for UTF-8 compliance, rawurlencodes and then escapes with htmlspecialchars(). If you wish to use the data on a landing page you must decode it with htmlspecialchars_decode() followed by rawurldecode() in that order. But really, if you are using any characters that need to be encoded in the first place you should probably just stop.
in ValidateString at line 59
bool
isAlnum(string $alnum)
Check that a string is comprised solely of alphanumeric characters.
Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 77
bool
isAlnumUnderscore(string $alnumUnderscore)
Check that a string is comprised solely of alphanumeric characters and underscores.
Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 95
bool
isAlpha(string $alpha)
Check that a string is comprised solely of alphabetical characters.
Tolerates vanilla ASCII only. Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 113
bool
isUtf8(string $text)
Check if the character encoding of text is UTF-8.
All strings received from external sources must be passed through this function, particularly prior to storage in the database.
in ValidateString at line 131
string
trimString(mixed $text)
Cast to string, check UTF-8 encoding and strip trailing whitespace and control characters.
Removes trailing whitespace and control characters (ASCII <= 32 / UTF-8 points 0-32 inclusive), checks for UTF-8 character set and casts input to a string. Note that the data returned by this function still requires escaping at the point of use; it is not database or XSS safe.
As the input is cast to a string do NOT apply this function to non-string types (int, float, bool, object, resource, null, array, etc).
in ValidateToken at line 40
boolean
validateToken(string $token)
Validate a cross-site request forgery token from a form submission.
Forms contain a hidden field with a random token taken from the user's session. This token is used to validate that a form submission did indeed originate from the user, by comparing the value against that stored in the user's session. If they do not match then the request could be a forgery and the form submission should be rejected.
in Viewable at line 39
string
pageTitle()
Return title of this page.
in Viewable at line 49
setPageTitle(string $pageTitle)
Set the title of this page.
in Viewable at line 69
setTemplate(string $template)
Set the template used by this page.
in Viewable at line 86
string
theme()
Return the theme used by this page.
in Viewable at line 98
setTheme(string $theme)
Set (change) the theme.
You must ensure that the new theme directory contains the HTML template files that you need.
in Viewable at line 115
array
metadata()
Return page-specific metadata overrides.
in Viewable at line 125
setMetadata(array $metadata)
Set page-specific overrides of the site metadata.
at line 53
__construct(object $model)
Constructor
at line 68
displayForm()
Display the change password form.
at line 77
displaySetPassword()
Display change password confirmation message (success or failure).
at line 103
string
backUrl()
Return the backUrl.
If the cancel button is clicked, the user will be redirected to the backUrl.
at line 113
setConfirm(string $confirm)
Set password confirmation.
at line 123
setPassword(string $password)
Set password.
at line 133
string
response()
Return the response message (success or failure) for an action.