slidge.command.register
=======================

.. py:module:: slidge.command.register

.. autoapi-nested-parse::

   This module handles the registration :term:`Command`, which is a necessary
   step for a JID to become a slidge :term:`User`.



Exceptions
----------

.. autoapisummary::

   slidge.command.register.TwoFactorNotRequired


Classes
-------

.. autoapisummary::

   slidge.command.register.RegistrationType


Module Contents
---------------

.. py:class:: RegistrationType



   An :class:`Enum` to define the registration flow.


   .. py:attribute:: SINGLE_STEP_FORM
      :value: 0


      1 step, 1 form, the only flow compatible with :xep:`0077`.
      Using this, the whole flow is defined
      by :attr:`slidge.BaseGateway.REGISTRATION_FIELDS` and
      :attr:`.REGISTRATION_INSTRUCTIONS`.



   .. py:attribute:: QRCODE
      :value: 10


      The registration requires flashing a QR code in an official client.
      See :meth:`slidge.BaseGateway.send_qr`, :meth:`.get_qr_text`
      and :meth:`.confirm_qr`.



   .. py:attribute:: TWO_FACTOR_CODE
      :value: 20


      The registration requires confirming login with a 2FA code,
      eg something received by email or SMS to finalize the authentication.
      See :meth:`.validate_two_factor_code`.



.. py:exception:: TwoFactorNotRequired



   Should be raised in :meth:`slidge.BaseGateway.validate` if the code is not
   required after all. This can happen for a :term:`Legacy Network` where 2FA
   is optional.


