##// END OF EJS Templates
Better error message and AR errors in log for failed LDAP on-the-fly user creation (closes #932, #1042)....
Jean-Philippe Lang -
r1330:a340d8c957bb
parent child
Show More
@@ -56,6 +56,8 class AccountController < ApplicationController
56 56 flash.now[:error] = l(:notice_account_invalid_creditentials)
57 57 end
58 58 end
59 rescue User::OnTheFlyCreationFailure
60 flash.now[:error] = 'Redmine could not retrieve the required information from the LDAP to create your account. Please, contact your Redmine administrator.'
59 61 end
60 62
61 63 # Log out current user and redirect to welcome page
@@ -18,6 +18,9
18 18 require "digest/sha1"
19 19
20 20 class User < ActiveRecord::Base
21
22 class OnTheFlyCreationFailure < Exception; end
23
21 24 # Account statuses
22 25 STATUS_ANONYMOUS = 0
23 26 STATUS_ACTIVE = 1
@@ -105,13 +108,15 class User < ActiveRecord::Base
105 108 onthefly.language = Setting.default_language
106 109 if onthefly.save
107 110 user = find(:first, :conditions => ["login=?", login])
108 logger.info("User '#{user.login}' created on the fly.") if logger
111 logger.info("User '#{user.login}' created from the LDAP") if logger
112 else
113 logger.error("User '#{onthefly.login}' found in LDAP but could not be created (#{onthefly.errors.full_messages.join(', ')})") if logger
114 raise OnTheFlyCreationFailure.new
109 115 end
110 116 end
111 117 end
112 118 user.update_attribute(:last_login_on, Time.now) if user
113 119 user
114
115 120 rescue => text
116 121 raise text
117 122 end
General Comments 0
You need to be logged in to leave comments. Login now