Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Includes:
- Authpwn::UserModel
- Defined in:
- lib/authpwn_rails/generators/templates/user.rb
Overview
An user account.
Class Method Summary collapse
-
.authenticate_signin(signin) ⇒ User, Symbol
Change this to customize user lookup in the e-mail/password signin process.
-
.create_from_omniauth(omniauth_hash) ⇒ User
Change this to customize on-demand user creation on OmniAuth signup.
-
.related_to_omniauth(omniauth_hash) ⇒ User
Change this to customize user lookup in the OmniAuth signup process.
Methods included from Authpwn::UserModel
#auth_bounce_reason, #set_default_exuid, #to_param
Class Method Details
.authenticate_signin(signin) ⇒ User, Symbol
Change this to customize user lookup in the e-mail/password signin process.
For example, to implement Facebook / Twitter’s ability to log in using either an e-mail address or a username, look up the user by the username, create a new Session with the e-mail and password, and pass it to super
21 22 23 |
# File 'lib/authpwn_rails/generators/templates/user.rb', line 21 def self.authenticate_signin(signin) super end |
.create_from_omniauth(omniauth_hash) ⇒ User
Change this to customize on-demand user creation on OmniAuth signup.
This method is called when there is no existing user matching the OmniAuth information, and is responsible for creating a user. It is an opportunity to collect the OmniAuth information to populate the user’s account.
The default implementation creates a user with the e-mail matching the ‘email’ key in the OmniAuth hash. If no e-mail key is present, no User is created.
54 55 56 |
# File 'lib/authpwn_rails/generators/templates/user.rb', line 54 def self.create_from_omniauth(omniauth_hash) super end |
.related_to_omniauth(omniauth_hash) ⇒ User
Change this to customize user lookup in the OmniAuth signup process.
This method is called when there is no Credential matching the OmniAuth information, but before create_from_omniauth. It is an opportunity to identify an existing user who uses a new sign-in method.
The default implementation finds an user whose e-mail matches the ‘email’ value in the OmniAuth hash.
37 38 39 |
# File 'lib/authpwn_rails/generators/templates/user.rb', line 37 def self.(omniauth_hash) super end |