Module: Card::Set::Right::Account::Views::Format

Extended by:
AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb

Instance Method Summary collapse

Instance Method Details

#new_token(extra_payload) ⇒ Object



43
44
45
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 43

def new_token extra_payload
  Auth::Token.encode card.accounted_id, extra_payload
end

#token_expiry_sentenceObject



39
40
41
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 39

def token_expiry_sentence
  "Link will expire in #{render_token_days} days"
end

#token_url(trigger, extra_payload = {}) ⇒ Object



33
34
35
36
37
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 33

def token_url trigger, extra_payload={}
  card_url path(action: :update,
                card: { trigger: trigger },
                token: new_token(extra_payload))
end

#view: reset_password_daysObject



31
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 31

view :reset_password_days, :token_days

#view: reset_password_urlObject



15
16
17
18
19
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 15

view :reset_password_url, denial: :blank do
  raise Error::PermissionDenied unless card.password_card.ok? :update

  token_url :reset_password
end

#view: token_daysObject



25
26
27
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 25

view :token_days, denial: :blank do
  Card.config.token_expiry / 1.day
end

#view: token_expiryObject



21
22
23
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 21

view :token_expiry, denial: :blank do
  "(#{token_expiry_sentence}"
end

#view: verify_daysObject

DEPRECATED



30
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 30

view :verify_days, :token_days

#view: verify_urlObject



9
10
11
12
13
# File 'platypus/tmp/set/gem-defaults/mod014-account/right/account/views.rb', line 9

view :verify_url, cache: :never, denial: :blank do
  raise Error::PermissionDenied unless card.ok?(:create) || card.action

  token_url :verify_and_activate, anonymous: true
end