Module: Biovision::Components::Users::FlagHelpers
- Included in:
- Biovision::Components::UsersComponent
- Defined in:
- app/lib/biovision/components/users/flag_helpers.rb
Overview
Helper methods for checking user flags
Instance Method Summary collapse
- #confirm_email? ⇒ Boolean
- #confirm_phone? ⇒ Boolean
- #email_as_login? ⇒ Boolean
- #invite_only? ⇒ Boolean
- #needs_email_confirmation? ⇒ Boolean
- #needs_phone_confirmation? ⇒ Boolean
- #phone_as_login? ⇒ Boolean
- #registration_open? ⇒ Boolean
- #require_email? ⇒ Boolean
- #require_phone? ⇒ Boolean
- #use_invites? ⇒ Boolean
- #use_phone? ⇒ Boolean
Instance Method Details
#confirm_email? ⇒ Boolean
45 46 47 48 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 45 def confirm_email? key = Biovision::Components::UsersComponent::SETTING_CONFIRM_EMAIL settings[key] end |
#confirm_phone? ⇒ Boolean
50 51 52 53 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 50 def confirm_phone? key = Biovision::Components::UsersComponent::SETTING_CONFIRM_PHONE settings[key] end |
#email_as_login? ⇒ Boolean
25 26 27 28 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 25 def email_as_login? key = Biovision::Components::UsersComponent::SETTING_EMAIL_AS_LOGIN settings[key] end |
#invite_only? ⇒ Boolean
55 56 57 58 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 55 def invite_only? key = Biovision::Components::UsersComponent::SETTING_INVITE_ONLY settings[key] end |
#needs_email_confirmation? ⇒ Boolean
8 9 10 11 12 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 8 def needs_email_confirmation? return false if user&.email_confirmed? confirm_email? && !user.email.blank? end |
#needs_phone_confirmation? ⇒ Boolean
14 15 16 17 18 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 14 def needs_phone_confirmation? return false if user&.phone_confirmed? confirm_phone? && !user.phone.blank? end |
#phone_as_login? ⇒ Boolean
30 31 32 33 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 30 def phone_as_login? key = Biovision::Components::UsersComponent::SETTING_PHONE_AS_LOGIN settings[key] end |
#registration_open? ⇒ Boolean
20 21 22 23 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 20 def registration_open? key = Biovision::Components::UsersComponent::SETTING_OPEN settings[key] end |
#require_email? ⇒ Boolean
35 36 37 38 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 35 def require_email? key = Biovision::Components::UsersComponent::SETTING_REQUIRE_EMAIL settings[key] || email_as_login? end |
#require_phone? ⇒ Boolean
40 41 42 43 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 40 def require_phone? key = Biovision::Components::UsersComponent::SETTING_REQUIRE_PHONE settings[key] || phone_as_login? end |
#use_invites? ⇒ Boolean
60 61 62 63 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 60 def use_invites? key = Biovision::Components::UsersComponent::SETTING_USE_INVITES settings[key] || invite_only? end |
#use_phone? ⇒ Boolean
65 66 67 68 |
# File 'app/lib/biovision/components/users/flag_helpers.rb', line 65 def use_phone? key = Biovision::Components::UsersComponent::SETTING_USE_PHONE settings[key] end |