Account
extends ComponentBase
in package
Account component
Allows users to register, sign in and update their account. They can also deactivate their account and resend the account verification email.
Table of Contents
- $alias : string
- $assetPath : string
- $componentCssClass : string
- $id : string
- $implement : array<string|int, mixed>
- $inspectorEnabled : bool
- $isHidden : bool
- $name : string
- $pluginIcon : string
- $assets : array<string|int, mixed>
- $controller : Controller
- $dirName : string
- $extendableCallbacks : array<string|int, mixed>
- $extendableGuardProperties : bool
- $extendableStaticMethods : array<string|int, mixed>
- $extensionData : array<string|int, mixed>
- $externalPropertyNames : array<string|int, mixed>
- $page : PageCode
- $properties : array<string|int, mixed>
- __call() : mixed
- __callStatic() : mixed
- __construct() : mixed
- Constructor
- __get() : mixed
- __set() : mixed
- __toString() : mixed
- Returns the component's alias, used by __SELF__
- activationCode() : string
- Looks for the activation code from the URL parameter. If nothing is found, the GET parameter 'activate' is used instead.
- addCss() : void
- Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
- addDynamicMethod() : mixed
- Programmatically adds a method to the extendable class
- addDynamicProperty() : mixed
- Programmatically adds a property to the extendable class
- addJs() : void
- Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
- addRss() : void
- Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
- asExtension() : mixed
- Short hand for `getClassExtension()` method, except takes the short extension name, example:
- canRegister() : mixed
- Flag for allowing registration, pulled from UserSettings
- clearExtendedClasses() : void
- Clear the list of extended classes so they will be re-extended.
- combineAssets() : string
- Run the provided assets through the Asset Combiner
- componentDetails() : mixed
- Returns information about this component, including name and description.
- defineProperties() : mixed
- extend() : mixed
- extendableCall() : mixed
- Magic method for `__call()`
- extendableCallStatic() : mixed
- Magic method for `__callStatic()`
- extendableConstruct() : mixed
- This method should be called as part of the constructor.
- extendableExtendCallback() : void
- Helper method for `::extend()` static method
- extendableGet() : string
- Magic method for `__get()`
- extendableSet() : string
- Magic method for `__set()`
- extendClassWith() : void
- Dynamically extend a class with a specified behavior
- fireSystemEvent() : mixed
- Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
- fireViewEvent() : string
- Special event function used for extending within view files, allowing HTML to be injected multiple times.
- flushAssets() : void
- Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.
- getAssetPath() : string
- Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
- getAssetPaths() : array<string|int, mixed>
- Returns an array of all registered asset paths.
- getClassExtension() : mixed
- Returns a behavior object from an extendable class, example:
- getClassMethods() : array<string|int, mixed>
- Get a list of class methods, extension equivalent of get_class_methods()
- getDynamicProperties() : array<string|int, mixed>
- Returns all dynamic properties and their values
- getPath() : mixed
- Returns the absolute component path.
- getProperties() : array<string|int, mixed>
- Returns all properties.
- getPropertyOptions() : array<string|int, mixed>
- Returns options for multi-option properties (drop-downs, etc.)
- getRedirectOptions() : mixed
- hasAssetsDefined() : bool
- Returns true if assets any have been added.
- init() : mixed
- Executed when this component is first initialized, before AJAX requests.
- isClassExtendedWith() : bool
- Check if extendable class is extended with a behavior object
- loginAttribute() : mixed
- Returns the login model attribute.
- loginAttributeLabel() : mixed
- Returns the login label as a word.
- makeAssets() : string
- Outputs `<link>` and `<script>` tags to load assets previously added with addJs and addCss method calls
- methodExists() : bool
- Checks if a method exists, extension equivalent of method_exists()
- onActivate() : mixed
- Activate the user
- onDeactivate() : mixed
- Deactivate user
- onRegister() : mixed
- Register the user
- onRender() : mixed
- Executed when this component is rendered on a page or layout.
- onRun() : mixed
- Executed when this component is bound to a page or layout.
- onSendActivationEmail() : mixed
- Trigger a subsequent activation email
- onSignin() : mixed
- Sign in the user
- onUpdate() : mixed
- Update the user
- paramName() : string
- Returns the external property name when the property value is a routing parameter reference.
- prepareVars() : mixed
- Executed when this component is initialized
- property() : string
- Returns a defined property value or default if one is not set.
- propertyExists() : bool
- Checks if a property exists, extension equivalent of `property_exists()`
- propertyName() : string
- Returns the external property name when the property value is an external property reference.
- rememberLoginMode() : mixed
- Returns the login remember mode.
- renderPartial() : mixed
- Renders a requested partial in context of this component, see Cms\Classes\Controller@renderPartial for usage.
- runAjaxHandler() : bool
- Executes the event cycle when running an AJAX handler.
- setExternalPropertyName() : string
- Sets an external property name.
- setExternalPropertyNames() : void
- Sets names used by external properties.
- setProperties() : void
- Sets multiple properties.
- setProperty() : void
- Sets a property value
- updateRequiresPassword() : mixed
- Returns the update requires password setting
- user() : mixed
- Returns the logged in user, if available
- validateProperties() : array<string|int, mixed>
- Validates the properties against the defined properties of the class.
- addAsset() : mixed
- Adds the provided asset to the internal asset collections
- extendableIsAccessible() : bool
- Checks if a property is accessible, property equivalent of `is_callable()`
- extensionExtractMethods() : void
- Extracts the available methods from a behavior and adds it to the list of callable methods.
- getAssetEntryBuildPath() : string
- Internal helper, attaches a build code to an asset path
- getAssetScheme() : string
- Internal helper, get asset scheme
- getLocalPath() : mixed
- isRegisterThrottled() : bool
- Returns true if user is throttled.
- makeActivationUrl() : string
- Returns a link used to activate the user account.
- makeRedirection() : mixed
- Redirect to the intended page after successful update, sign in or registration.
- redirectForceSecure() : mixed
- Checks if the force secure property is enabled and if so returns a redirect object.
- removeDuplicates() : void
- Removes duplicate assets from the entire collection.
- sendActivationEmail() : void
- Sends the activation email to a user
Properties
$alias
public
string
$alias
Alias used for this component.
$assetPath
public
string
$assetPath
Specifies a path to the asset directory.
$componentCssClass
public
string
$componentCssClass
Component CSS class name for the back-end page/layout component list. This field is used by the CMS internally.
$id
public
string
$id
A unique identifier for this component.
$implement
public
array<string|int, mixed>
$implement
Extensions implemented by this class.
$inspectorEnabled
public
bool
$inspectorEnabled
= true
Determines whether Inspector can be used with the component. This field is used by the CMS internally.
$isHidden
public
bool
$isHidden
= false
Determines whether the component is hidden from the back-end UI.
$name
public
string
$name
Component class name or class alias used in the component declaration in a template.
$pluginIcon
public
string
$pluginIcon
Icon of the plugin that defines the component. This field is used by the CMS internally.
$assets
protected
array<string|int, mixed>
$assets
= ['js' => [], 'css' => [], 'rss' => []]
Collection of assets to display in the layout.
$controller
protected
Controller
$controller
Controller object.
$dirName
protected
string
$dirName
Specifies the component directory name.
$extendableCallbacks
protected
static array<string|int, mixed>
$extendableCallbacks
= []
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
$extendableGuardProperties
protected
static bool
$extendableGuardProperties
= true
Indicates if dynamic properties can be created.
$extendableStaticMethods
protected
static array<string|int, mixed>
$extendableStaticMethods
= []
Collection of static methods used by behaviors.
$extensionData
protected
array<string|int, mixed>
$extensionData
= ['extensions' => [], 'methods' => [], 'dynamicMethods' => [], 'dynamicProperties' => []]
Class reflection information, including behaviors.
$externalPropertyNames
protected
array<string|int, mixed>
$externalPropertyNames
= []
A collection of external property names used by this component.
$page
protected
PageCode
$page
Page object object.
$properties
protected
array<string|int, mixed>
$properties
= []
Contains the object property values.
Methods
__call()
public
__call(mixed $name, mixed $params) : mixed
Parameters
- $name : mixed
- $params : mixed
Return values
mixed —__callStatic()
public
static __callStatic(mixed $name, mixed $params) : mixed
Parameters
- $name : mixed
- $params : mixed
Return values
mixed —__construct()
Constructor
public
__construct() : mixed
Return values
mixed —__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Return values
mixed —__toString()
Returns the component's alias, used by __SELF__
public
__toString() : mixed
Return values
mixed —activationCode()
Looks for the activation code from the URL parameter. If nothing is found, the GET parameter 'activate' is used instead.
public
activationCode() : string
Return values
string —addCss()
Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
public
addCss(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
- $name : string
-
Specifies a path (URL) to the script.
- $attributes : array<string|int, mixed> = []
-
Adds extra HTML attributes to the asset link.
Return values
void —addDynamicMethod()
Programmatically adds a method to the extendable class
public
addDynamicMethod(string $dynamicName, callable $method[, string $extension = null ]) : mixed
Parameters
- $dynamicName : string
- $method : callable
- $extension : string = null
Return values
mixed —addDynamicProperty()
Programmatically adds a property to the extendable class
public
addDynamicProperty(string $dynamicName[, string $value = null ]) : mixed
Parameters
- $dynamicName : string
- $value : string = null
Return values
mixed —addJs()
Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
public
addJs(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
- $name : string
-
Specifies a path (URL) to the script.
- $attributes : array<string|int, mixed> = []
-
Adds extra HTML attributes to the asset link.
Return values
void —addRss()
Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
public
addRss(string $name[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
- $name : string
-
Specifies a path (URL) to the RSS channel
- $attributes : array<string|int, mixed> = []
-
Adds extra HTML attributes to the asset link.
Return values
void —asExtension()
Short hand for `getClassExtension()` method, except takes the short extension name, example:
public
asExtension(string $shortName) : mixed
$this->asExtension('FormController')
Parameters
- $shortName : string
Return values
mixed —canRegister()
Flag for allowing registration, pulled from UserSettings
public
canRegister() : mixed
Return values
mixed —clearExtendedClasses()
Clear the list of extended classes so they will be re-extended.
public
static clearExtendedClasses() : void
Return values
void —combineAssets()
Run the provided assets through the Asset Combiner
public
combineAssets(array<string|int, mixed> $assets[, string $localPath = '' ]) : string
Parameters
- $assets : array<string|int, mixed>
-
Collection of assets
- $localPath : string = ''
-
Prefix all assets with this path (optional)
Return values
string —componentDetails()
Returns information about this component, including name and description.
public
componentDetails() : mixed
Return values
mixed —defineProperties()
public
defineProperties() : mixed
Return values
mixed —extend()
public
static extend(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —extendableCall()
Magic method for `__call()`
public
extendableCall(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed> = null
Return values
mixed —extendableCallStatic()
Magic method for `__callStatic()`
public
static extendableCallStatic(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed> = null
Return values
mixed —extendableConstruct()
This method should be called as part of the constructor.
public
extendableConstruct() : mixed
Return values
mixed —extendableExtendCallback()
Helper method for `::extend()` static method
public
static extendableExtendCallback(callable $callback) : void
Parameters
- $callback : callable
Return values
void —extendableGet()
Magic method for `__get()`
public
extendableGet(string $name) : string
Parameters
- $name : string
Return values
string —extendableSet()
Magic method for `__set()`
public
extendableSet(string $name, string $value) : string
Parameters
- $name : string
- $value : string
Return values
string —extendClassWith()
Dynamically extend a class with a specified behavior
public
extendClassWith(string $extensionName) : void
Parameters
- $extensionName : string
Return values
void —fireSystemEvent()
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
public
fireSystemEvent(string $event[, array<string|int, mixed> $params = [] ][, bool $halt = true ]) : mixed
For example:
$this->fireSystemEvent('backend.list.myEvent', ['my value']);
Is equivalent to:
$this->fireEvent('list.myEvent', ['myvalue'], true);
Event::fire('backend.list.myEvent', [$this, 'myvalue'], true);
Parameters
- $event : string
-
Event name
- $params : array<string|int, mixed> = []
-
Event parameters
- $halt : bool = true
-
Halt after first non-null result
Return values
mixed —fireViewEvent()
Special event function used for extending within view files, allowing HTML to be injected multiple times.
public
fireViewEvent(string $event[, array<string|int, mixed> $params = [] ]) : string
For example:
= $this->fireViewEvent('backend.auth.extendSigninView') ?>Parameters
- $event : string
-
Event name
- $params : array<string|int, mixed> = []
-
Event parameters
Return values
string —flushAssets()
Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.
public
flushAssets() : void
Return values
void —getAssetPath()
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
public
getAssetPath(string $fileName[, string $assetPath = null ]) : string
Parameters
- $fileName : string
-
File to load.
- $assetPath : string = null
-
Explicitly define an asset path.
Return values
string —Relative path to the asset file.
getAssetPaths()
Returns an array of all registered asset paths.
public
getAssetPaths() : array<string|int, mixed>
Return values
array<string|int, mixed> —getClassExtension()
Returns a behavior object from an extendable class, example:
public
getClassExtension(string $name) : mixed
$this->getClassExtension('Backend.Behaviors.FormController')
Parameters
- $name : string
-
Fully qualified behavior name
Return values
mixed —getClassMethods()
Get a list of class methods, extension equivalent of get_class_methods()
public
getClassMethods() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDynamicProperties()
Returns all dynamic properties and their values
public
getDynamicProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —['property' => 'value']
getPath()
Returns the absolute component path.
public
getPath() : mixed
Return values
mixed —getProperties()
Returns all properties.
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —getPropertyOptions()
Returns options for multi-option properties (drop-downs, etc.)
public
getPropertyOptions(string $property) : array<string|int, mixed>
Parameters
- $property : string
-
Specifies the property name
Return values
array<string|int, mixed> —Return an array of option values and descriptions
getRedirectOptions()
public
getRedirectOptions() : mixed
Return values
mixed —hasAssetsDefined()
Returns true if assets any have been added.
public
hasAssetsDefined() : bool
Return values
bool —init()
Executed when this component is first initialized, before AJAX requests.
public
init() : mixed
Return values
mixed —isClassExtendedWith()
Check if extendable class is extended with a behavior object
public
isClassExtendedWith(string $name) : bool
Parameters
- $name : string
-
Fully qualified behavior name
Return values
bool —loginAttribute()
Returns the login model attribute.
public
loginAttribute() : mixed
Return values
mixed —loginAttributeLabel()
Returns the login label as a word.
public
loginAttributeLabel() : mixed
Return values
mixed —makeAssets()
Outputs `<link>` and `<script>` tags to load assets previously added with addJs and addCss method calls
public
makeAssets([string $type = null ]) : string
Parameters
- $type : string = null
-
Return an asset collection of a given type (css, rss, js) or null for all.
Return values
string —methodExists()
Checks if a method exists, extension equivalent of method_exists()
public
methodExists(string $name) : bool
Parameters
- $name : string
Return values
bool —onActivate()
Activate the user
public
onActivate([string $code = null ]) : mixed
Parameters
- $code : string = null
-
Activation code
Return values
mixed —onDeactivate()
Deactivate user
public
onDeactivate() : mixed
Return values
mixed —onRegister()
Register the user
public
onRegister() : mixed
Return values
mixed —onRender()
Executed when this component is rendered on a page or layout.
public
onRender() : mixed
Return values
mixed —onRun()
Executed when this component is bound to a page or layout.
public
onRun() : mixed
Return values
mixed —onSendActivationEmail()
Trigger a subsequent activation email
public
onSendActivationEmail() : mixed
Return values
mixed —onSignin()
Sign in the user
public
onSignin() : mixed
Return values
mixed —onUpdate()
Update the user
public
onUpdate() : mixed
Return values
mixed —paramName()
Returns the external property name when the property value is a routing parameter reference.
public
paramName(string $name[, mixed $default = null ]) : string
Otherwise the default value specified is returned.
Parameters
- $name : string
-
The property name
- $default : mixed = null
Return values
string —prepareVars()
Executed when this component is initialized
public
prepareVars() : mixed
Return values
mixed —property()
Returns a defined property value or default if one is not set.
public
property(string $name[, string $default = null ]) : string
Parameters
- $name : string
-
The property name to look for.
- $default : string = null
-
A default value to return if no name is found.
Return values
string —The property value or the default specified.
propertyExists()
Checks if a property exists, extension equivalent of `property_exists()`
public
propertyExists(string $name) : bool
Parameters
- $name : string
Return values
bool —propertyName()
Returns the external property name when the property value is an external property reference.
public
propertyName(string $name[, mixed $default = null ]) : string
Otherwise the default value specified is returned.
Parameters
- $name : string
-
The property name
- $default : mixed = null
Return values
string —rememberLoginMode()
Returns the login remember mode.
public
rememberLoginMode() : mixed
Return values
mixed —renderPartial()
Renders a requested partial in context of this component, see Cms\Classes\Controller@renderPartial for usage.
public
renderPartial() : mixed
Return values
mixed —runAjaxHandler()
Executes the event cycle when running an AJAX handler.
public
runAjaxHandler(mixed $handler) : bool
Parameters
- $handler : mixed
Return values
bool —Returns true if the handler was found. Returns false otherwise.
setExternalPropertyName()
Sets an external property name.
public
setExternalPropertyName(string $name, string $extName) : string
Parameters
- $name : string
-
Property name
- $extName : string
-
External property name
Return values
string —setExternalPropertyNames()
Sets names used by external properties.
public
setExternalPropertyNames(array<string|int, mixed> $names) : void
Parameters
- $names : array<string|int, mixed>
-
The key should be the property name, the value should be the external property name.
Return values
void —setProperties()
Sets multiple properties.
public
setProperties(array<string|int, mixed> $properties) : void
Parameters
- $properties : array<string|int, mixed>
Return values
void —setProperty()
Sets a property value
public
setProperty(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Return values
void —updateRequiresPassword()
Returns the update requires password setting
public
updateRequiresPassword() : mixed
Return values
mixed —user()
Returns the logged in user, if available
public
user() : mixed
Return values
mixed —validateProperties()
Validates the properties against the defined properties of the class.
public
validateProperties(array<string|int, mixed> $properties) : array<string|int, mixed>
This method also sets default properties.
Parameters
- $properties : array<string|int, mixed>
-
The supplied property values.
Return values
array<string|int, mixed> —The validated property set, with defaults applied.
addAsset()
Adds the provided asset to the internal asset collections
protected
addAsset(string $type, string $path, array<string|int, mixed> $attributes) : mixed
Parameters
- $type : string
-
The type of the asset: 'js' || 'css' || 'rss'
- $path : string
-
The path to the asset
- $attributes : array<string|int, mixed>
-
The attributes for the asset
Return values
mixed —extendableIsAccessible()
Checks if a property is accessible, property equivalent of `is_callable()`
protected
extendableIsAccessible(mixed $class, string $propertyName) : bool
Parameters
- $class : mixed
- $propertyName : string
Return values
bool —extensionExtractMethods()
Extracts the available methods from a behavior and adds it to the list of callable methods.
protected
extensionExtractMethods(string $extensionName, object $extensionObject) : void
Parameters
- $extensionName : string
- $extensionObject : object
Return values
void —getAssetEntryBuildPath()
Internal helper, attaches a build code to an asset path
protected
getAssetEntryBuildPath(array<string|int, mixed> $asset) : string
Parameters
- $asset : array<string|int, mixed>
-
Stored asset array
Return values
string —getAssetScheme()
Internal helper, get asset scheme
protected
getAssetScheme(string $asset) : string
Parameters
- $asset : string
-
Specifies a path (URL) to the asset.
Return values
string —getLocalPath()
protected
getLocalPath(string $relativePath) : mixed
Parameters
- $relativePath : string
Return values
mixed —isRegisterThrottled()
Returns true if user is throttled.
protected
isRegisterThrottled() : bool
Return values
bool —makeActivationUrl()
Returns a link used to activate the user account.
protected
makeActivationUrl(mixed $code) : string
Parameters
- $code : mixed
Return values
string —makeRedirection()
Redirect to the intended page after successful update, sign in or registration.
protected
makeRedirection([mixed $intended = false ]) : mixed
The URL can come from the "redirect" property or the "redirect" postback value.
Parameters
- $intended : mixed = false
Return values
mixed —redirectForceSecure()
Checks if the force secure property is enabled and if so returns a redirect object.
protected
redirectForceSecure() : mixed
Return values
mixed —removeDuplicates()
Removes duplicate assets from the entire collection.
protected
removeDuplicates() : void
Return values
void —sendActivationEmail()
Sends the activation email to a user
protected
sendActivationEmail(User $user) : void
Parameters
- $user : User