FIX: bust broken password

This commit is contained in:
Sam 2013-11-11 22:28:26 +11:00
parent e5fd2946e0
commit 3473734af0
1 changed files with 2 additions and 6 deletions

View File

@ -156,18 +156,14 @@ class UsersController < ApplicationController
@user = EmailToken.confirm(params[:token])
if @user.blank?
flash[:error] = I18n.t('password_reset.no_token')
else
raise Discourse::InvalidParameters.new(:password) unless good_reset_request_format
elsif request.put?
raise Discourse::InvalidParameters.new(:password) unless params[:password].present?
@user.password = params[:password]
logon_after_password_reset if @user.save
end
render layout: 'no_js'
end
def good_reset_request_format
request.put? && params[:password].present?
end
def logon_after_password_reset
message = if Guardian.new(@user).can_access_forum?
# Log in the user