ProcessLogin class
Provides Login capability for ProcessWire
Example of simple front-end login, logged-in, and logout flow:
$login = $modules->get('ProcessLogin');
$login->allowEmail = 0; // 0=login w/username, 1=login w/email, 2=either
if(!$user->isLoggedin()) {
$out = $login->execute();
} else if($input->get('logout') === $user->name) {
$out = $login->executeLogout();
} else {
$login->message("Welcome $user->name you are logged in");
$out = "<p><a href='./?logout=$user->name'>Logout</a></p>";
}
// render errors, warnings and messages
foreach($notices as $notice) {
$text = $sanitizer->entities($notice->text);
echo "<p class='$notice->className'>$text</p>";
}
// output markup for login form, etc.
echo $out;
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Process
class also inherits all the methods and properties of: Process, WireData and Wire.
Common
For hooks
These methods are only useful for hooking and should not be called directly.
Properties
Name | Return | Summary | Default |
---|---|---|---|
Process | bool int | Whether or not email login is allowed (0|false=off, 1|true=Yes, 2=Yes or name also allowed) | |
Process | bool | Whether the ProcessForgotPassword module is installed. | |
Process | string | Field name used for email login (when enabled). | |
Process | int | Optionally populate with an Inputfield::skipLabel* constant to be used on the login form inputs. | |
Process | array | Auto-enable for these role IDs, or blank for all roles. Applies only if $tfaAutoType selected | [] |
Process | string | Auto-enable type, aka module name | '' |
Process | array | Role IDs where admin prompts/recommends them to enable TFA. | |
Process | int | Allow user to remember their browser and bypass TFA for this many days (-1=no limit, 0=disabled) | |
Process | array | Means by which to fingerprint user’s browser |
Additional methods and properties
In addition to the methods and properties above, Process
API reference based on ProcessWire core version 3.0.251