summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-31 17:02:34 -0400
committerDavid Gay <david@davidgay.org>2021-05-31 17:02:34 -0400
commit7113d69455d9600baa6d26796fb5b0d0ced1c939 (patch)
tree522665fbfcf800e0803e88c82e73a38bbd662388
parent9e01676407d761a31b530bc63c82548871827089 (diff)
Automatically start resting on logout
-rw-r--r--CHANGELOG.md1
-rw-r--r--config/initializers/devise.rb7
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 579f35b..b7dc048 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
### Added
- Characters can now rest.
- To make your character rest, click the button on the Character screen. To stop resting, click the button again.
+ - Also, if you click "Logout", your character will automatically start resting.
- While resting, you will be unable to perform activities, but you will accumulate rested time. This time is
automatially spent to lower your timers on activities, down to a minimum timer of 10 seconds.
- The normal minimum timer for an activity can be broken in this way, but other timer reductions are still held
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 2bf00cf..16a3ecc 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -126,7 +126,7 @@ Devise.setup do |config|
config.stretches = Rails.env.test? ? 1 : 12
# Set up a pepper to generate the hashed password.
- config.pepper = '3e1720e4cab9aff2366b15db51f2d059aa8ba78ae2506f6a0f22da73969e252b766f8903f18a100f1960c1e43f28d03860d02135b52baf812117981f48a951f6'
+ config.pepper = "3e1720e4cab9aff2366b15db51f2d059aa8ba78ae2506f6a0f22da73969e252b766f8903f18a100f1960c1e43f28d03860d02135b52baf812117981f48a951f6"
# Send a notification to the original email when the user's email is changed.
# config.send_email_changed_notification = false
@@ -308,4 +308,9 @@ Devise.setup do |config|
# When set to false, does not sign a user in automatically after their password is
# changed. Defaults to true, so a user is signed in automatically after changing a password.
# config.sign_in_after_change_password = true
+
+ # ==> Before logout configuration
+ Warden::Manager.before_logout do |user, _, _|
+ user.active_character&.start_resting
+ end
end