Загрузка...

Simple Rails authentication

In this video, I show you how to make your own authentication in Ruby on Rails, from scratch. We make use of the has_secure_password module (don’t forget to enable the 'bcrypt' gem) and create a login form, logout and all of the helpers you will need for accessing the current account and prevent pages from being viewed by logged out accounts.

It’s a bit of a longer video and not very polished, let me know in the comments if you appreciate the more raw feel or not.

Chapters:
0:00 Introduction and recap from the last video
2:28 Authentication helper methods
4:40 current_account helper
4:53 Authenticating routes
6:07 Logout button
8:00 Sign-in form
11:47 Link login/register pages
13:43 Handle invalid credentials
15:50 Wrapping up...

You'll find the docs for has_secure_password here:
https://edgeapi.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html

All of the code for this tutorial is available on GitHub:
- If you want to follow along you’ll find the project at the beginning of the video on this branch:
https://github.com/phawk/coinfusion/tree/roll_your_auth_1
- And the completed authentication example is here:
https://github.com/phawk/coinfusion/tree/roll_your_auth_2

---

Has this video helped you out? Consider buying me a coffee to say thanks and support future content like this, thanks!
https://app.payhere.co/rapid-ruby/buy-me-a-coffee-aa4618e4-45d1-4727-81b9-2d081449d61d

You can also find more content like this, including premium courses and exclusive community and mentorship to help you level-up! Head over to https://rapidruby.com and use the code RRYOUTUBE for a discount!

Видео Simple Rails authentication канала Rapid Ruby
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять