Skip to content
  1. Extras
  2. UserAuthHash

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

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

ParameterDefaultDescription
userUser ID or email
loginContextContexts for login, comma-separated. E.g. &contexts=web,ru,en
excludeContextContexts to exclude, comma-separated
lifeTime1hAuth 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 sudo key.
  • For blocked users.
  • In the mgr context.