Better error message and AR errors in log for failed LDAP on-the-fly user creation (closes #932, #1042).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1345 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8eb86396e1
commit
a340d8c957
|
@ -56,6 +56,8 @@ class AccountController < ApplicationController
|
|||
flash.now[:error] = l(:notice_account_invalid_creditentials)
|
||||
end
|
||||
end
|
||||
rescue User::OnTheFlyCreationFailure
|
||||
flash.now[:error] = 'Redmine could not retrieve the required information from the LDAP to create your account. Please, contact your Redmine administrator.'
|
||||
end
|
||||
|
||||
# Log out current user and redirect to welcome page
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
require "digest/sha1"
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
|
||||
class OnTheFlyCreationFailure < Exception; end
|
||||
|
||||
# Account statuses
|
||||
STATUS_ANONYMOUS = 0
|
||||
STATUS_ACTIVE = 1
|
||||
|
@ -105,15 +108,17 @@ class User < ActiveRecord::Base
|
|||
onthefly.language = Setting.default_language
|
||||
if onthefly.save
|
||||
user = find(:first, :conditions => ["login=?", login])
|
||||
logger.info("User '#{user.login}' created on the fly.") if logger
|
||||
logger.info("User '#{user.login}' created from the LDAP") if logger
|
||||
else
|
||||
logger.error("User '#{onthefly.login}' found in LDAP but could not be created (#{onthefly.errors.full_messages.join(', ')})") if logger
|
||||
raise OnTheFlyCreationFailure.new
|
||||
end
|
||||
end
|
||||
end
|
||||
user.update_attribute(:last_login_on, Time.now) if user
|
||||
user
|
||||
|
||||
rescue => text
|
||||
raise text
|
||||
rescue => text
|
||||
raise text
|
||||
end
|
||||
|
||||
# Return user's full name for display
|
||||
|
|
Loading…
Reference in New Issue