diff --git a/_posts/2024-03-19-turbo-8-instantclick-prefetch.md b/_posts/2024-03-19-turbo-8-instantclick-prefetch.md index 3258429..3e3a7cc 100644 --- a/_posts/2024-03-19-turbo-8-instantclick-prefetch.md +++ b/_posts/2024-03-19-turbo-8-instantclick-prefetch.md @@ -4,6 +4,7 @@ title: "Turbo 8 Prefetch (InstantClick)" author: Yaroslav Shmarov tags: turbo-rails prefetch instantclick thumbnail: /assets/thumbnails/turbo.png +youtube_id: CxWPMnRoud0 --- Inspired by [instaclick.io](http://instantclick.io/), instaclick [has been added](https://github.com/hotwired/turbo/pull/1101) as a default behaviour in Turbo 8. diff --git a/_posts/2024-03-24-secutiry-manage-active-sessions.md b/_posts/2024-03-24-secutiry-manage-active-sessions.md index 9e66de1..2e3a89c 100644 --- a/_posts/2024-03-24-secutiry-manage-active-sessions.md +++ b/_posts/2024-03-24-secutiry-manage-active-sessions.md @@ -8,7 +8,19 @@ thumbnail: /assets/thumbnails/encryption-lock.png Ok, so sometimes to enchance security of your application you will want to allow users to see all the devices/browsers they are logged in with. You would also provided a button to sign out of a device/browser. -Here's how you can do it: +Here's how you can manage your login activity in Meta/Facebook: + +![meta-account-login-activity](/assets/images/meta-account-login-activity.png) + +![meta-where-youre-logged-in](/assets/images/meta-where-youre-logged-in.png) + +Here's how it can look in a Rails app using devise: + +![manage active sessions](/assets/images/manage-active-sessions.gif) + +- Sign in creates a login +- Sign out deletes a login +- Deleting a login will log the user out of a device ### 1. Store current login (device/browser) info and ensure the current device/browser has not been logged out. @@ -83,6 +95,8 @@ rails generate devise:controllers users -c=sessions ```ruby # app/controllers/users/sessions_controller.rb class Users::SessionsController < Devise::SessionsController + # skip_before_action :require_login, only: :create + def create super do |resource| create_login if resource.persisted? @@ -172,3 +186,4 @@ That's it! 🤗 Inspired by: - [vitobotta - Manage active sessions in Rails](https://vitobotta.com/2016/10/19/manage-active-sessions-) - [adamcooke/authie](https://github.com/adamcooke/authie) +- [Facebook Login activity](https://accountscenter.facebook.com/password_and_security/login_activity) diff --git a/assets/images/manage-active-sessions.gif b/assets/images/manage-active-sessions.gif new file mode 100644 index 0000000..0dc5ec5 Binary files /dev/null and b/assets/images/manage-active-sessions.gif differ diff --git a/assets/images/meta-account-login-activity.png b/assets/images/meta-account-login-activity.png new file mode 100644 index 0000000..9a0c7ae Binary files /dev/null and b/assets/images/meta-account-login-activity.png differ diff --git a/assets/images/meta-where-youre-logged-in.png b/assets/images/meta-where-youre-logged-in.png new file mode 100644 index 0000000..4658485 Binary files /dev/null and b/assets/images/meta-where-youre-logged-in.png differ