Class: User::UpdateDetails

Inherits:
UserPlane::Command show all
Includes:
ActiveModel::Validations::Callbacks
Defined in:
app/models/user/update_details.rb

Defined Under Namespace

Classes: PasswordDetails

Instance Method Summary collapse

Methods inherited from UserPlane::Command

#perform, #perform!, #perform_validations

Instance Method Details

#emailObject



61
62
63
# File 'app/models/user/update_details.rb', line 61

def email
  email_identity && email_identity.address
end

#email=(address) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'app/models/user/update_details.rb', line 65

def email= address
  unless address == email
    if email_identity.new_record?
      email_identity.address = address
    else
      email_identity.unverified_address = address
    end
  end
end

#email_identityObject



84
85
86
# File 'app/models/user/update_details.rb', line 84

def email_identity
  @account.email || @account.build_email
end

#email_verificationObject



75
76
77
# File 'app/models/user/update_details.rb', line 75

def email_verification
  email_identity.address_change_verification if email_identity.unverified_address_changed?
end

#failed_password_change?Boolean

Returns ture if a new password was set, but the change was rejected.

Returns:

  • (Boolean)


80
81
82
# File 'app/models/user/update_details.rb', line 80

def failed_password_change?
  password_details.changed? && !email_identity.password_digest_changed? ? true : false
end

#password_detailsObject



88
89
90
# File 'app/models/user/update_details.rb', line 88

def password_details
  @password_details ||= PasswordDetails.new()
end

#persisted?Boolean

Ensures that polymorphic_url treats this as a singular resource

Returns:

  • (Boolean)


47
48
49
# File 'app/models/user/update_details.rb', line 47

def persisted?
  true
end

#to_paramObject

Ensures that polymorphic_url treats this as a singular resource



53
54
55
# File 'app/models/user/update_details.rb', line 53

def to_param
  nil
end