slidge.core.command.register#

The register commands, either by chat or adhoc command

Note that single step forms via jabber:iq:register are handled in xep_0077

Module Contents#

Classes#

RegistrationType

The type of registration for a gateway

Register

Abstract base class to implement gateway commands (chatbot and ad-hoc)

class slidge.core.command.register.RegistrationType[source]#

Bases: int, enum.Enum

The type of registration for a gateway

Initialize self. See help(type(self)) for accurate signature.

SINGLE_STEP_FORM = 0[source]#
QRCODE = 10[source]#
TWO_FACTOR_CODE = 20[source]#
exception slidge.core.command.register.TwoFactorNotRequired[source]#

Bases: Exception

Should be raised by two-factor code validation function in case the code is not required after all.

Initialize self. See help(type(self)) for accurate signature.

class slidge.core.command.register.Register(xmpp)[source]#

Bases: slidge.core.command.base.Command

Abstract base class to implement gateway commands (chatbot and ad-hoc)

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME = 'Register to the gateway'[source]#
HELP = 'Link your JID to this gateway'[source]#
NODE = 'jabber:iq:register'[source]#
CHAT_COMMAND = 'register'[source]#
ACCESS[source]#
SUCCESS_MESSAGE = 'Success, welcome!'[source]#
_finalize(user)[source]#
Parameters:

user (slidge.util.db.GatewayUser) –

async run(_session, _ifrom, *_)[source]#

Entry point of the command

Parameters:
  • session – If triggered by a registered user, its slidge Session

  • ifrom – JID of the command-triggering entity

  • args – When triggered via chatbot type message, additional words after the CHAT_COMMAND string was passed

Returns:

Either a TableResult, a Form, a Confirmation, a text, or None

async register(form_values, _session, ifrom)[source]#
Parameters:
  • form_values (dict[str, Any]) –

  • ifrom (slixmpp.JID) –

async two_fa(form_values, _session, _ifrom, user)[source]#
Parameters:
async qr(_form_values, _session, _ifrom, user)[source]#
Parameters: