Skip to content

Commit

Permalink
Updated OpenID related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ariejan committed Oct 24, 2008
1 parent 9c5a930 commit f1adda8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 0 additions & 2 deletions app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ class ProfilesController < ApplicationController
before_filter :find_profile
before_filter :check_owner_access, :only => [:edit, :update]

require_role :user, :only => [:edit, :update]

def show
# render show.html.erb
end
Expand Down
16 changes: 15 additions & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def destroy
end

def open_id_authentication
authenticate_with_open_id do |result, identity_url|
authenticate_with_open_id(params[:openid_url], :required => [:nickname, :email]) do |result, identity_url|
if result.successful? && self.current_user = User.find_by_identity_url(identity_url)
successful_login
else
Expand All @@ -50,6 +50,20 @@ def password_authentication
end

def successful_login
# It's possible to use OpenID only, in which
# case the following would update a user's email and nickname
# on login.
#
# This may give conflicts when used in combination with regular
# user accounts.
#
# TODO: Add a configuration option to disable regular accounts.
#
# current_user.update_attributes(
# :login => "#{params[:openid.sreg.nickname]}",
# :email => "#{params[:openid.sreg.email]}"
# )

new_cookie_flag = (params[:remember_me] == "1")
handle_remember_cookie! new_cookie_flag
redirect_back_or_default(root_path)
Expand Down
6 changes: 6 additions & 0 deletions app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<% end -%>
<%= render :partial => 'profiles/my_account' if current_user == @user %>
<% unless @profile.user.not_using_openid? %>
<p>
This is your <%= configatron.site_name %> profile. It's not related to your OpenID Identity.
</p>
<% end %>
<% form_for :profile, @profile, :url => profile_url(@profile.user), :html => {:method => :put} do |f| %>
Expand Down

0 comments on commit f1adda8

Please sign in to comment.