Sha256: 8a391588516b9d25fe8459f2f578e5c3753fe715e57f102aaca6502b58631785
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require 'quo_vadis/engine' module QuoVadis # # Redirection URLs # # The URL to redirect the user to after s/he signs in. mattr_accessor :signed_in_url @@signed_in_url = :root # Whether the `:signed_in_url` should override the URL the user was trying # to reach when they were made to authenticate. mattr_accessor :override_original_url @@override_original_url = false def self.signed_in_url(user, original_url) if original_url && !@@override_original_url original_url else @@signed_in_url.respond_to?(:call) ? @@signed_in_url.call(user) : @@signed_in_url end end # The URL to redirect the user to after s/he signs out. mattr_accessor :signed_out_url @@signed_in_url = :root # # Hooks # # Code to run when the user has signed in. mattr_accessor :signed_in_hook @@signed_in_hook = nil def self.signed_in_hook(user, request) @@signed_in_hook.call(user, request) if @@signed_in_hook end # Code to run when someone has tried but failed to sign in. mattr_accessor :failed_sign_in_hook @@failed_sign_in_hook = nil def self.failed_sign_in_hook(request) @@failed_sign_in_hook.call(request) if @@failed_sign_in_hook end # Code to run just before the user has signed out. mattr_accessor :signed_out_hook @@signed_out_hook = nil def self.signed_out_hook(user, request) @@signed_out_hook.call(user, request) if @@signed_out_hook end # Configure from the initializer. def self.configure yield self end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quo_vadis-1.0.0 | lib/quo_vadis.rb |