summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-07 18:27:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-07 18:27:34 +0000
commit193b571e67c17a4de1a0b6128b35ea7c7c620ba6 (patch)
tree206f6eb091aa7b5a7f4f7a53abd453af44deeedf /app
parenta1d0acd632d70d1b279501de1220ca2df5ebb63e (diff)
downloadredmine-193b571e67c17a4de1a0b6128b35ea7c7c620ba6.tar.gz
redmine-193b571e67c17a4de1a0b6128b35ea7c7c620ba6.zip
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9943 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/account_controller.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 7d57b45da..c9cefe8c7 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -63,11 +63,17 @@ class AccountController < ApplicationController
return
else
if request.post?
- user = User.find_by_mail(params[:mail])
- # user not found in db
- (flash.now[:error] = l(:notice_account_unknown_email); return) unless user
- # user uses an external authentification
- (flash.now[:error] = l(:notice_can_t_change_password); return) if user.auth_source_id
+ user = User.find_by_mail(params[:mail].to_s)
+ # user not found or not active
+ unless user && user.active?
+ flash.now[:error] = l(:notice_account_unknown_email)
+ return
+ end
+ # user cannot change its password
+ unless user.change_password_allowed?
+ flash.now[:error] = l(:notice_can_t_change_password)
+ return
+ end
# create a new token for password recovery
token = Token.new(:user => user, :action => "recovery")
if token.save