Blackbook.Authentication
Handles core authentication “stuff” - verifying who the user is,resetting information etc.
Summary
Functions
The core “login” method that takes an email and password
Each user is granted a single token login at registration. This method uses that unique token to log them in
Changes the user’s password
Returns a password reminder token the user can use to validate against and then reset their password. Expires in 24 hours
Each user has a random user key assigned to them at registration. This is a good candidate for use as a session key
Validates a password reset token by 1) making sure it exists and 2) making sure it isn’t expired. The user record is returned
Functions
The core “login” method that takes an email and password.
Examples
{:ok, user} = Blackbook.Authentication.authenticate_by_email_password 'test@test.com', 'password'
Each user is granted a single token login at registration. This method uses that unique token to log them in.
Examples
{:ok, user} = Blackbook.Authentication.authenticate_by_token 'BIGLONGTOKEN'
Changes the user’s password.
Examples
{:ok, user} = Blackbook.Authentication.change_password 'test@test.com', 'password', 'new_password'
Returns a password reminder token the user can use to validate against and then reset their password. Expires in 24 hours.
Examples
token = Blackbook.Authentication.get_reminder_token 'test@test.com'
Each user has a random user key assigned to them at registration. This is a good candidate for use as a session key.
Examples
{:ok, user} = Blackbook.Authentication.get_user 'MY_USER_KEY'