MishkaCmsCore.Accounts.Changes.EnforceMasterEmailSeparation (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Refuses a master an address a site's account already holds.

A user created with no site is a master. Such a creation is refused, with the address in the error, when any site's account holds that email.

A site's own registration is not checked against the master accounts. A site signs in, resets and registers only its own accounts, so on a site a master's address is one nobody there holds and registers as one; refusing it would tell a stranger on that site that a master holds it.

The check runs as a before-action hook, with Ash.exists?/2, so it reads no account.

change {MishkaCmsCore.Accounts.Changes.EnforceMasterEmailSeparation, []}

Summary

Functions

Adds the check to a creation that makes a master.

Functions

change(changeset, opts, context)

Adds the check to a creation that makes a master.

Returns

The changeset, with a before-action hook that adds an error on :email when a site's account holds the address of a master being created.