@@ -209,7 +209,11 private | |||||
209 | end |
|
209 | end | |
210 | else |
|
210 | else | |
211 | # Existing record |
|
211 | # Existing record | |
|
212 | if user.active? | |||
212 | successful_authentication(user) |
|
213 | successful_authentication(user) | |
|
214 | else | |||
|
215 | account_pending | |||
|
216 | end | |||
213 | end |
|
217 | end | |
214 | end |
|
218 | end | |
215 | end |
|
219 | end | |
@@ -269,10 +273,14 private | |||||
269 | if user.save |
|
273 | if user.save | |
270 | # Sends an email to the administrators |
|
274 | # Sends an email to the administrators | |
271 | Mailer.deliver_account_activation_request(user) |
|
275 | Mailer.deliver_account_activation_request(user) | |
272 |
|
|
276 | account_pending | |
273 | redirect_to :action => 'login' |
|
|||
274 | else |
|
277 | else | |
275 | yield if block_given? |
|
278 | yield if block_given? | |
276 | end |
|
279 | end | |
277 | end |
|
280 | end | |
|
281 | ||||
|
282 | def account_pending | |||
|
283 | flash[:notice] = l(:notice_account_pending) | |||
|
284 | redirect_to :action => 'login' | |||
|
285 | end | |||
278 | end |
|
286 | end |
@@ -80,6 +80,21 class AccountControllerTest < Test::Unit::TestCase | |||||
80 | assert_redirected_to 'my/page' |
|
80 | assert_redirected_to 'my/page' | |
81 | end |
|
81 | end | |
82 |
|
82 | |||
|
83 | def test_login_with_openid_for_existing_non_active_user | |||
|
84 | Setting.self_registration = '2' | |||
|
85 | Setting.openid = '1' | |||
|
86 | existing_user = User.new(:firstname => 'Cool', | |||
|
87 | :lastname => 'User', | |||
|
88 | :mail => 'user@somedomain.com', | |||
|
89 | :identity_url => 'http://openid.example.com/good_user', | |||
|
90 | :status => User::STATUS_REGISTERED) | |||
|
91 | existing_user.login = 'cool_user' | |||
|
92 | assert existing_user.save! | |||
|
93 | ||||
|
94 | post :login, :openid_url => existing_user.identity_url | |||
|
95 | assert_redirected_to 'login' | |||
|
96 | end | |||
|
97 | ||||
83 | def test_login_with_openid_with_new_user_created |
|
98 | def test_login_with_openid_with_new_user_created | |
84 | Setting.self_registration = '3' |
|
99 | Setting.self_registration = '3' | |
85 | Setting.openid = '1' |
|
100 | Setting.openid = '1' |
General Comments 0
You need to be logged in to leave comments.
Login now