register

Function register 

Source
pub fn register(
    db: &Database,
    item: &RegisterInput,
    mailer: &Mailer,
) -> Result<(), (u16, &'static str)>
Expand description

/register

creates a new User with the information in item

sends an email, using mailer, to the email address in item that contains a unique link that allows the recipient to activate the account associated with that email address

§Errors

  • 400: Already registered

§Panics

  • could not connect to database
  • could not get SECRET_KEY from environment
  • any of the database operations fail

TODO: don’t panic if db connection fails, just return an error