New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User activity not working #771
Comments
Hi @luizkowalski have you solved this problem already? If not, can you paste the whole |
hey, sorry for the delay, I was working on something else. Here is the file # The first thing you need to configure is which modules you need in your app.
# The default is nothing which will include only core features (password encryption, login/logout).
# Available submodules are: :user_activation, :http_basic_auth, :remember_me,
# :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :external
Rails.application.config.sorcery.submodules = [:activity_logging, :user_activation, :reset_password]
# Here you can configure each submodule's features.
Rails.application.config.sorcery.configure do |config|
config.user_config do |user|
# -- core --
# specify username attributes, for example: [:username, :email].
# Default: `[:email]`
#
user.username_attribute_names = [:email]
# change *virtual* password attribute, the one which is used until an encrypted one is generated.
# Default: `:password`
#
# user.password_attribute_name =
# downcase the username before trying to authenticate, default is false
# Default: `false`
#
# user.downcase_username_before_authenticating =
# change default email attribute.
# Default: `:email`
#
# user.email_attribute_name =
# change default crypted_password attribute.
# Default: `:crypted_password`
#
# user.crypted_password_attribute_name =
# what pattern to use to join the password with the salt
# Default: `""`
#
# user.salt_join_token =
# change default salt attribute.
# Default: `:salt`
#
# user.salt_attribute_name =
# how many times to apply encryption to the password.
# Default: `nil`
#
# user.stretches =
# encryption key used to encrypt reversible encryptions such as AES256.
# WARNING: If used for users' passwords, changing this key will leave passwords undecryptable!
# Default: `nil`
#
# user.encryption_key =
# use an external encryption class.
# Default: `nil`
#
# user.custom_encryption_provider =
# encryption algorithm name. See 'encryption_algorithm=' for available options.
# Default: `:bcrypt`
#
# user.encryption_algorithm =
# make this configuration inheritable for subclasses. Useful for ActiveRecord's STI.
# Default: `false`
#
# user.subclasses_inherit_config =
# -- remember_me --
# How long in seconds the session length will be
# Default: `604800`
#
# user.remember_me_for =
# -- user_activation --
# the attribute name to hold activation state (active/pending).
# Default: `:activation_state`
#
# user.activation_state_attribute_name =
# the attribute name to hold activation code (sent by email).
# Default: `:activation_token`
#
# user.activation_token_attribute_name =
# the attribute name to hold activation code expiration date.
# Default: `:activation_token_expires_at`
#
# user.activation_token_expires_at_attribute_name =
# how many seconds before the activation code expires. nil for never expires.
# Default: `nil`
#
user.activation_token_expiration_period = 7.days.to_i
# your mailer class. Required.
# Default: `nil`
#
# user.user_activation_mailer = UserMailer
# when true sorcery will not automatically
# email activation details and allow you to
# manually handle how and when email is sent.
# Default: `false`
#
user.activation_mailer_disabled = true
#
user.reset_password_mailer_disabled = true
# how many seconds before the reset request expires. nil for never expires.
# Default: `nil`
#
user.reset_password_expiration_period = 24.hours.to_i
end
# This line must come after the 'user config' block.
# Define which model authenticates with sorcery.
config.user_class = 'User'
end |
Hey @luizkowalski, did you figure this out or did you just end up rolling with a different solution? Sorcery is currently transitioning maintainers, so if you still want help myself or @Ch4s3 could probably take a look. At a glance, I would hazard a guess it's because there's no session being created, and the tracking is attached to the session creation. |
I'm developing an API (no using rails-api, but rails itself) and at some point, I need to login the user, so I'm doing something like this
turns out that when I call
login
, the user is not being "tracked". the fields ip address, last login/activity date are not changed at all. I think I get everything configured, but maybe I missed something:user.rb
sorcery.rb
The API is stateless of course, so I never call
logout
. Is this somehow connected to the problem?I'm using Rails 4.2.6 with Sorcery 0.9.1
The text was updated successfully, but these errors were encountered: