-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
30 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,14 @@ | ||
class User < ActiveRecord::Base | ||
# Include default devise modules. Others available are: | ||
# :token_authenticatable, :confirmable, :lockable and :timeoutable | ||
devise :database_authenticatable, :openid_authenticatable, :registerable, :recoverable, :trackable, :validatable | ||
# devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable | ||
# devise :openid_authenticatable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :trackable, :validatable, | ||
:token_authenticatable, :confirmable | ||
|
||
# Setup accessible (or protected) attributes for your model | ||
# attr_accessible :email, :password, :password_confirmation, :remember_me, :identity_url | ||
attr_accessible :name, :email, :password, :password_confirmation, :remember_me | ||
|
||
# Handle creation of user authenticated via OpenID | ||
def self.create_from_identity_url(identity_url) | ||
User.find_or_initialize_by_identity_url(identity_url) | ||
def to_s | ||
name || email | ||
end | ||
|
||
# Set email as a required field from the Open ID provider | ||
def self.openid_required_fields | ||
["email", "http://axschema.org/contact/email"] | ||
end | ||
|
||
# Accept fields from Open ID provider | ||
def openid_fields=(fields) | ||
fields.each do |key, value| | ||
case key.to_s | ||
when "email", "http://axschema.org/contact/email" | ||
case value | ||
when Array | ||
self.email = value.first | ||
else | ||
self.email = value | ||
end | ||
if alt = self.class.find_by_email(email) and alt.id != id | ||
self.id = alt.id | ||
self.reload | ||
@new_record = false | ||
end | ||
end | ||
end | ||
|
||
# Create this user | ||
self.save! | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters