Module: Devise
- Defined in:
- lib/devise/monkeypatch.rb,
lib/devise/monkeypatch.rb,
lib/devise/passwordless.rb,
lib/devise/passwordless/version.rb,
app/mailers/devise/passwordless/mailer.rb,
lib/devise/models/magic_link_authenticatable.rb,
lib/devise/models/magic_link_authenticatable.rb,
lib/devise/strategies/magic_link_authenticatable.rb
Overview
Extend Devise’s Helpers module to add our after_magic_link_sent_path_for This is defined here as a helper rather than in the sessions controller directly so that it can be overridden in the main ApplicationController
Defined Under Namespace
Modules: Controllers, Models, Passwordless, Strategies Classes: MagicLinksController, Mapping
Constant Summary collapse
- @@passwordless_tokenizer =
nil
- @@passwordless_login_within =
20.minutes
- @@passwordless_secret_key =
nil
- @@passwordless_expire_old_tokens_on_sign_in =
false
Class Method Summary collapse
Class Method Details
.add_module(module_name, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/devise/monkeypatch.rb', line 9 def self.add_module(module_name, = {}) .assert_valid_keys(:strategy, :model, :controller, :route, :no_input, :insert_at) ALL.insert ([:insert_at] || -1), module_name if strategy = [:strategy] strategy = (strategy == true ? module_name : strategy) STRATEGIES[module_name] = strategy end if controller = [:controller] controller = (controller == true ? module_name : controller) CONTROLLERS[module_name] = controller end NO_INPUT << strategy if [:no_input] if route = [:route] routes = {} case route when TrueClass routes[module_name] = [] when Symbol routes[route] = [] when Hash routes = route else raise ArgumentError, ":route should be true, a Symbol or a Hash" end routes.each do |key, value| URL_HELPERS[key] ||= [] URL_HELPERS[key].concat(value) URL_HELPERS[key].uniq! ROUTES[module_name] = key end if routes.size > 1 ROUTES[module_name] = routes.keys end end if [:model] path = ([:model] == true ? "devise/models/#{module_name}" : [:model]) camelized = ActiveSupport::Inflector.camelize(module_name.to_s) Devise::Models.send(:autoload, camelized.to_sym, path) end Devise::Mapping.add_module module_name end |
.passwordless_tokenizer ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/devise/models/magic_link_authenticatable.rb', line 108 def self.passwordless_tokenizer if @@passwordless_tokenizer.blank? Devise::Passwordless.deprecator.warn <<-DEPRECATION.strip_heredoc [Devise-Passwordless] `Devise.passwordless_tokenizer` is a required config option. If you are upgrading to Devise-Passwordless 1.0 from a previous install, you should use "MessageEncryptorTokenizer" for backwards compatibility. New installs are templated with "SignedGlobalIDTokenizer". Read the README for a comparison of options and UPGRADING for upgrade instructions. Execution will now proceed with a value of "MessageEncryptorTokenizer" but future releases will raise an error if this option is unset. DEPRECATION "MessageEncryptorTokenizer" else @@passwordless_tokenizer end end |