DEV Community

Duke1014
Duke1014

Posted on

Project 4: Soundboard (and My Experience with User Authentication

My journey with Flatiron school is almost at an end. The other week I was reminiscing about how we had our final zoom class together, and barely noticed it. The journey has been long and hard, but very rewarding, but more on that in another blog.

In our final zoom classes, we discussed user authentication and passwords via Ruby on Rails. Surprisingly, our project said that password protection integration was optional. What's interesting about this is that password protection is SO simple!

Imagine your user model. It "has_many" whatever it has. Yeah, that's cool, pretty simple, no big deal, but that code looks so lonely. What if this simple bit of model code had a friend?

class User < ApplicationRecord
has_secure_password
has_many :whatever
end

BAM! We're good to go.

Sure, you have to put in a little bit of front-end work to put in passwords for your sign-up and log-in features, but what is a little less work for a LOT more security? My cybersecurity friends told me many horror stories about their work, hacking into different companies' systems. The idea of not having a password, even on the simplest of applications, makes me think of them, and how easy it is to have information taken from someone. Why not reinforce your software and applications with a simple password?

One of the last things needed to be added to an app is a super simple parameter for your user controller - :password_confirmation. This parameter is already taken care of for you with that one little line in your model.

Yup. You has_secure_password now.

Time for the final phase of school: the Capstone Project!

Discussion (0)