Module: Card::Set::Right::Account
Overview
Defined Under Namespace
Modules: EmailHtmlFormat, Format, HtmlFormat
Constant Summary
Constants included
from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Card::Set
reset_modules
Methods included from I18nScope
#mod_name, #scope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#method_missing, #num_set_parts, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscore
#attachment, #ensure_set, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
#permit
Class Method Details
.source_location ⇒ Object
7
|
# File 'tmpsets/set/mod017-follow/right/account.rb', line 7
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/follow/set/right/account.rb"; end
|
Instance Method Details
#active? ⇒ Boolean
80
81
82
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 80
def active?
status == "active"
end
|
#blocked? ⇒ Boolean
84
85
86
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 84
def blocked?
status == "blocked"
end
|
#built_in? ⇒ Boolean
88
89
90
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 88
def built_in?
status == "system"
end
|
#can_approve? ⇒ Boolean
124
125
126
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 124
def can_approve?
Card.new(type_id: Card.default_accounted_type_id).ok? :create
end
|
#changes_visible?(act) ⇒ Boolean
149
150
151
152
153
154
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 149
def changes_visible? act
act.actions_affecting(act.card).each do |action|
return true if action.card.ok? :read
end
false
end
|
#edit_password_success_args ⇒ Object
FIXME: explain or remove.
147
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 147
def edit_password_success_args; end
|
#ok_to_read ⇒ Object
128
129
130
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 128
def ok_to_read
own_account? ? true : super
end
|
#pending? ⇒ Boolean
92
93
94
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 92
def pending?
status == "pending"
end
|
#refreshed_token ⇒ Object
116
117
118
119
120
121
122
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 116
def refreshed_token
if token_card.id
token_card.refresh(true).db_content else "[token]"
end
end
|
#reset_password_success ⇒ Object
132
133
134
135
136
137
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 132
def reset_password_success
token_card.used!
Auth.signin left_id
{ id: name,
view: :edit }
end
|
#reset_password_try_again ⇒ Object
139
140
141
142
143
144
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 139
def reset_password_try_again
send_reset_password_token
{ id: "_self",
view: "message",
message: tr(:sorry_email_reset, error_msg: errors.first.last) }
end
|
#reset_password_with_token(token) ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 103
def reset_password_with_token token
aborting do
if !token
errors.add :token, "is required"
elsif !validate_token!(token)
success << reset_password_try_again
else
success << reset_password_success
end
end
end
|
#send_change_notice(act, followed_set, follow_option) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'tmpsets/set/mod017-follow/right/account.rb', line 8
def send_change_notice act, followed_set, follow_option
return unless changes_visible?(act)
Auth.as(left.id) do
Card[:follower_notification_email].deliver(
act.card, { to: email },
auth: left,
active_notice: { follower: left.name,
followed_set: followed_set,
follow_option: follow_option }
)
end
end
|
#validate_token!(test_token) ⇒ Object
96
97
98
99
100
101
|
# File 'tmpsets/set/mod025-account/right/account.rb', line 96
def validate_token! test_token
tcard = token_card
tcard.validate! test_token
copy_errors tcard
errors.empty?
end
|