UserAuthHash
The component implements user login via a hash code.
You can try the package before buying at modhost.pro.
Features
- Login without username and password by visiting a link with a hash code.
- You can enable/disable hash login, set hash lifetime, and choose login contexts.
Installation
- Add our repository.
- Install UserAuthHash.
You can try the package at modhost.pro; these extras can be selected when creating a site.
Description
UserAuthHash lets users log in without entering username and password by visiting the site with a hash code.
You can set the hash lifetime and choose login contexts.
Snippet for generating auth hash UserAuthHash
Parameters
| Parameter | Default | Description |
|---|---|---|
| user | User ID or email | |
| loginContext | Contexts for login, comma-separated. E.g. &contexts=web,ru,en | |
| excludeContext | Contexts to exclude, comma-separated | |
| lifeTime | 1h | Auth hash lifetime. E.g. &lifeTime=1h — 1 hour |
Call example
modx
<a href="[[++site_start]]?auth_hash=[[!UserAuthHash? &user=`2` &lifeTime=`1h`]]&msorder=1">Orders</a>fenom
{set $args = [
'msorder' => 1,
'auth_hash' => ('!UserAuthHash' | snippet:['user' => 2, 'lifeTime' => '1h'])
]}
<a href="{'site_start' | option | url : ['scheme' => 'full', 'xhtml_urls' => 0] : $args}">Orders</a>fenom
{set $args = [
'msorder' => 1,
'auth_hash' => (['user' => 'test@gmail.com', 'lifeTime' => '1h'] | getAuthHash)
]}
<a href="{'site_start' | option | url : ['scheme' => 'full', 'xhtml_urls' => 0] : $args}">Orders</a>Note
Login does not work:
- For users with the
sudokey. - For blocked users.
- In the
mgrcontext.
