Objectives |
---|
Implement a User model that securely stores passwords. |
Build routes, controllers, and views necessary for a typical user flow. |
Add a current_user application-level helper method to keep track of the currently signed in user. |
I get it, some of you have heard of Devise. That's cool and all but they recommend that if you're new to rails:
If you are building your first Rails application, we recommend you do not use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch. ... [docs]
In order to "roll our own" authentication we're going to follow this tutorial.
Don't copy/paste the tutorial, this is the most important part and to avoid copy-pasta we're going to change some core pieces.
- Your rails app can't be named "gif_vault".
- Your rails app must not include any routes related to "gifs".
- You must be able to explain these terms:
-
`bcrypt`
The bcrypt function is the default password hash algorithm for BSD and other systems ... [wiki]
A method of doing one-way hashes of passwords.
-
CSRF Token
Synchronizer token pattern is a technique where a token, secret and unique value for each request, is embedded by the web application in all HTML forms and verified on the server side. The token may be generated by any method that ensures unpredictability and uniqueness ... [wiki]
-
has_secure_password
- Don't let an authenticated user signup or login a second time.
- Implement
password_confirmation
for new users. - Create the ability to "remember me" for users logging in.
- How long do you remember them for?
- Add ability to reset a password.
- Instead of a separate login view, give your site a navbar and add the login form to the nav.
- Support 3rd-party authentication on your own.
- Could be github auth.