Module: Sorcery::Model::TemporaryToken

Defined in:
lib/sorcery/model/temporary_token.rb

Overview

This module encapsulates the logic for temporary token. A temporary token is created to identify a user in scenarios such as reseting password and activating the user by email.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.generate_random_tokenObject

Random code, used for salt and temporary tokens.



16
17
18
# File 'lib/sorcery/model/temporary_token.rb', line 16

def self.generate_random_token
  SecureRandom.urlsafe_base64(@sorcery_config.token_randomness).tr('lIO0', 'sxyz')
end

.included(base) ⇒ Object



9
10
11
12
13
# File 'lib/sorcery/model/temporary_token.rb', line 9

def self.included(base)
  # FIXME: This may not be the ideal way of passing sorcery_config to generate_random_token.
  @sorcery_config = base.sorcery_config
  base.extend(ClassMethods)
end