Class: BackOffice::Reset

Inherits:
Password show all
Defined in:
lib/back_office/reset.rb

Instance Attribute Summary collapse

Attributes inherited from Password

#email, #plaintext, #plaintext_confirmation

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Password

#update, #user

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



3
4
5
# File 'lib/back_office/reset.rb', line 3

def token
  @token
end

Class Method Details

.find(token) ⇒ Object



7
8
9
10
11
# File 'lib/back_office/reset.rb', line 7

def self.find(token)
  if email = BackOffice.decrypt(token)
    new(email: email, token: token)
  end
end

Instance Method Details

#saveObject



17
18
19
20
21
22
# File 'lib/back_office/reset.rb', line 17

def save
  if token.nil? && valid?(:create)
    @token = BackOffice.encrypt(email)
    true
  end
end

#to_paramObject



13
14
15
# File 'lib/back_office/reset.rb', line 13

def to_param
  token
end