Email Preferences App
- Clone locally using
git clone firstname.lastname@example.org:janephilipps/email-preferences.git
- Install dependencies using
- Make sure you have a local instance of PostgreSQL running
- Setup and seed database using
- Start server using
- Navigate to app in browser.
You will see a table of users with associated tokens for each user. You can use the button and links provided next to the user listing to create tokens associated with the user, edit the user (without URL params, to make it easier to test without security), show the user record, or delete the user record. You can use the link next to the token to edit the user (with URL params, to make it easier to test with security).
The technologies I used to build this app are: Ruby on Rails (v4.2.6) and PostgreSQL (v9.6.1).
If you try to create a new user or edit an existing user with an email address that already exists, a warning will pop up saying "A user with that email address already exists!".
I used SecureRandom to generate the nonce for each token, so each nonce will be unique.
Email settings view
If you navigate to the email settings view without any query params, or without the correct email address or token params, a flash message will pop up saying "Access denied!" and no changes will be accepted.
For the UI, if you check "Do not email", if any of the other boxes are checked, they will be unchecked. Conversely, if "Do not email" is checked and you check "Marketing", "Articles", or "Digest", "Do not email" will be unchecked.