Class: ServiceDesk::CustomEmailVerification
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ServiceDesk::CustomEmailVerification
- Includes:
- Gitlab::EncryptedAttribute
- Defined in:
- app/models/service_desk/custom_email_verification.rb
Constant Summary collapse
- TIMEFRAME =
30.minutes
- STATES =
{ started: 0, finished: 1, failed: 2 }.freeze
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.generate_token ⇒ Object
100 101 102 |
# File 'app/models/service_desk/custom_email_verification.rb', line 100 def generate_token SecureRandom.alphanumeric(12) end |
Instance Method Details
#accepted_until ⇒ Object
105 106 107 108 109 110 |
# File 'app/models/service_desk/custom_email_verification.rb', line 105 def accepted_until return unless started? return unless triggered_at.present? TIMEFRAME.since(triggered_at) end |
#in_timeframe? ⇒ Boolean
112 113 114 115 116 |
# File 'app/models/service_desk/custom_email_verification.rb', line 112 def in_timeframe? return false unless started? !!accepted_until&.future? end |