I'd like to build an Elixir library for passwordless login.
Modeled after this post, with a few alterations: http://inaka.net/blog/2016/07/27/passwordless-login-with-phoenix
The library would generate (or provide) a number of things:
- A migration for a
login_keys
table with 3 columns: [email
,key
,created_at
] - HTML template for submitting an email
- Email template for mailing login key
- Session routes and controllers
- Cron to delete login keys older than n [minutes, hours, days]
- User navigates to
/login
- User submits their email to form that does a
POST
to/login_keys
- System searches in for user by email a. If no user found, return error b. If user found, step 3
- System creates login key for email
- System sends an email to user with unique link to login
- User clicks link (
/login_keys/:uuid
) - System looks for login_key in table a. If no login_key found, return error b. If login_key found, step 7
- System finds login key