module Authpwn::UserExtensions::EmailField
Augments the User
model with an email virtual attribute.
Public Instance Methods
email()
click to toggle source
The e-mail from the user's Email credential.
Returns nil if this user has no Email credential.
# File lib/authpwn_rails/user_extensions/email_field.rb, line 46 def email credential = self.email_credential credential && credential.email end
email=(new_email)
click to toggle source
Sets the e-mail on the user's Email credential.
Creates a new Credentials::Email instance if necessary.
# File lib/authpwn_rails/user_extensions/email_field.rb, line 54 def email=(new_email) if credential = self.email_credential credential.email = new_email else credentials << Credentials::Email.new(email: new_email) end new_email end
email_credential()
click to toggle source
Credentials::Email instance associated with this user.
# File lib/authpwn_rails/user_extensions/email_field.rb, line 39 def email_credential credentials.find { |c| c.instance_of?(Credentials::Email) } end