Haytni.InvitablePlugin (Haytni v0.7.0) View Source
This plugin provides the feature of registration on invitation or sponsorship.
Fields: none
Configuration:
invitation_quota
(default::infinity
): the maximum amount of invitation a user can send. Possible values::infinity
if illimited{count, :total}
, count being a number, to restrict the user to a total of count invitation{count, :unaccepted}
, count being a number, to limit the user to count pending invitation
email_matching_invitation
(default:false
):true
to force users who accept the invitation to register with the same email address they received the invitation frominvitation_required
(default:true
):true
if users can only register with a valid invitation.false
to make it optional (sponsorship).invitation_within
(default:{30, :day}
): laps of time before the invitation can no longer be used (expiration)invitation_sent_to_index_name
(default:nil
): the name of the index on sent_to column if you have to explicit itstack Haytni.InvitablePlugin, invitation_required: true, invitation_quota: :infinity, invitation_within: {30, :day}, email_matching_invitation: false, invitation_sent_to_index_name: nil
Routes:
haytni_<scope>_invitation_path
(actions: new/create): default path is"/invitations"
but you can customize it to whatever you want by specifying the option:invitation_path
to your YourApp.Haytni.routes/1 call in your router (eg:YourApp.Haytni.routes(invitation_path: "/sponsorship")
)
Link to this section Summary
Functions
Build an invitation associated to user.
Callback implementation for Haytni.Plugin.find_user/3
.
Callback implementation for Haytni.Plugin.invalid?/3
.
The translated string set as error when invitation token does not exist
The translated string set as error when email address does not match the invitation
The translated string set as error when invitation has expired
The translated string set as error when invitation quota is exceeded
The translated string set as error when invitation are required but any was provided
Converts an invitation to an Ecto.Changeset
by applying the changes from params
Callback implementation for Haytni.Plugin.on_delete_user/4
.
Callback implementation for Haytni.Plugin.on_email_change/4
.
Callback implementation for Haytni.Plugin.on_failed_authentication/5
.
Callback implementation for Haytni.Plugin.on_logout/3
.
Callback implementation for Haytni.Plugin.on_successful_authentication/6
.
Generates a length long random code
Resend (email) an invitation
Sends an invitation (by email) from user after checking if its quota (invitation_quota
) allows it to
Callback implementation for Haytni.Plugin.validate_password/3
.
Callback implementation for Haytni.Plugin.validate_update_registration/3
.
Link to this section Types
Specs
invitation() :: struct()
Link to this section Functions
Specs
build_and_assoc_invitation(user :: Haytni.user(), attrs :: Keyword.t() | map()) :: invitation()
Build an invitation associated to user.
Valid attributes (keys) for attrs are:
:code
(required): the unique token associated to the invitation:sent_at
(required): when (DateTime
) the invitation was sent:sent_to
(required): the email address the invitation was sent to:accepted_by
(for testing purpose only): the id of the user who accepted the invitation:accepted_at
(for testing purpose only): when (DateTime
) the invitation was accepted:id
(for testing purpose only): force a (not nil) id for an in-memory (not persisted to database) invitation
Callback implementation for Haytni.Plugin.find_user/3
.
Callback implementation for Haytni.Plugin.invalid?/3
.
Specs
invalid_invitation_message() :: String.t()
The translated string set as error when invitation token does not exist
Specs
invitation_email_mismatch_message() :: String.t()
The translated string set as error when email address does not match the invitation
Specs
invitation_expired_message() :: String.t()
The translated string set as error when invitation has expired
Specs
invitation_quota_exceeded_message(count :: pos_integer()) :: String.t()
The translated string set as error when invitation quota is exceeded
Specs
invitation_required_message() :: String.t()
The translated string set as error when invitation are required but any was provided
Specs
invitation_to_changeset( invitation :: invitation(), config :: Haytni.InvitablePlugin.Config.t(), params :: Haytni.params() ) :: Ecto.Changeset.t()
Converts an invitation to an Ecto.Changeset
by applying the changes from params
Callback implementation for Haytni.Plugin.on_delete_user/4
.
Callback implementation for Haytni.Plugin.on_email_change/4
.
Callback implementation for Haytni.Plugin.on_failed_authentication/5
.
Callback implementation for Haytni.Plugin.on_logout/3
.
on_successful_authentication(conn, user, multi, keywords, module, config)
View SourceCallback implementation for Haytni.Plugin.on_successful_authentication/6
.
Generates a length long random code
Specs
resend_information( module :: module(), config :: Haytni.InvitablePlugin.Config.t(), invitation :: invitation() ) :: {:ok, true}
Resend (email) an invitation
Note: there is no checking and invitation.sender must have been preloaded
Specs
send_invitation( module :: module(), config :: Haytni.InvitablePlugin.Config.t(), invitation_params :: Haytni.params(), user :: Haytni.user() ) :: Haytni.repo_nobang_operation(invitation())
Sends an invitation (by email) from user after checking if its quota (invitation_quota
) allows it to
Callback implementation for Haytni.Plugin.validate_password/3
.
Callback implementation for Haytni.Plugin.validate_update_registration/3
.