Project

General

Profile

Actions

Defect #7074

closed

Trying to post a reply

Added by Seaders O'Loinsigh over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-12-08
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I'm trying to post the below text as a solution to my other question, http://www.redmine.org/boards/2/topics/19995, but I keep getting told that it looks like spam. Any idea why?


So I started poking 'round and got this all done myself, mainly through edits to 'account_controller.rb'.

I made a few superficial edits to login.rhtml and register.rhtml, to stop showing the username and password form by wrapping them in a '<% if not Setting.openid? %>' tag. Here's where the main part was done, though,

 def open_id_authenticate(openid_username)
 if not openid_username.nil?
  openid_url = 'http://openid.myserver.com/identity/' + openid_username
 end

 authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration|
 if result.successful?
  user = User.find_or_initialize_by_identity_url(identity_url)
   if user.new_record?
   user.login = registration['nickname'] unless registration['nickname'].nil?
   user.mail = registration['email'] unless registration['email'].nil?
   user.firstname, user.lastname = registration['fullname'].split(' ') unless registration['fullname'].nil?
   user.random_password user.register register_automatically(user) do
    onthefly_creation_failed(user)
   end 
=begin
We are registering with openid registration only, so this is not needed.
 case Setting.self_registration
  when '1'
   register_by_email_activation(user) do
    onthefly_creation_failed(user)
   end
  when '3'
   register_automatically(user) do
    onthefly_creation_failed(user)
   end
  else
   register_manually_by_administrator(user) do
    onthefly_creation_failed(user)
   end
  end
=end
 else
# Existing record
 if user.active?
  successful_authentication(user)
 else
  account_pending
 end 
end

I also threw in 'invalid_credentials' to password_authentication there, to ensure that can't come in at all. So now registration is disabled, but you can login and automatically get registered, but only if you're coming from our OpenID server. Working perfect now!
Actions

Also available in: Atom PDF