Spark Invite is designed for the use case where user account can been pre-populated, e.g. through information provided by a 3rd party, and an invitation needs to be sent so the prospective user can 'claim' their account.
For example, within a system bulk creation of new user accounts may be required to ensure security, consistency and for convenience. Once a new user account has been created the SparkInvite package can be used to manage the process of the account being claimed. The stages are:
A referrer, on a referral team (as the referrer may be a member of more than one team), invites the new user account. This is encapsulated in the Invitation model.
An invite event is fired, allowing for code outside of the SparkInvite package to verify the invite before issuing any communication. For example, automatic checks for email address domains or manual verification potentially requiring communication by telephone prior to invitation issue.
An issued event is fired allowing for accept/reject links to be issued. The actual sending of the invitation is done outside of the SparkInvites package, allowing your system to use your preference of package/method of communication.
If the user accepts the invitation the user is immediately asked to reset their password using Spark's standard password reset mechanism. A user may also reject an invitation.
An invitation can expire, and either soft-expiry (allows for recovery of the invitation unless expired invitations are manually cleaned up) or hard-expiry (once an invitation has expired it cannot be used).
When there is an issue with a token, e.g. doesn't exist or has been revoked, the invitation controller redirects back to the route defined in the configuration setting sparkinvites.routes.on-error. When redirecting the user one of the sparkinvites.messages is passed under the variable name configured by sparkinvite.flash, which can be displayed in your view. For example, using Vue.js and Notify.js (plus underscore.string/lodash for capitalization and sprintf for string creation) the following component will do this: