2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: Raise the right error when email params is missing.

This commit is contained in:
Guo Xiang Tan 2017-06-12 17:48:32 +09:00
parent 23420c0817
commit 5994c85ea9
2 changed files with 14 additions and 2 deletions

View file

@ -292,6 +292,7 @@ class UsersController < ApplicationController
end
def create
params.require(:email)
params.permit(:user_fields)
unless SiteSetting.allow_new_registrations
@ -302,7 +303,7 @@ class UsersController < ApplicationController
return fail_with("login.password_too_long")
end
if params[:email] && params[:email].length > 254 + 1 + 253
if params[:email].length > 254 + 1 + 253
return fail_with("login.email_too_long")
end
@ -310,7 +311,7 @@ class UsersController < ApplicationController
return fail_with("login.reserved_username")
end
if user = User.where(staged: true).find_by(email: params[:email].strip.downcase)
if user = User.find_by(staged: true, email: params[:email].strip.downcase)
user_params.each { |k, v| user.send("#{k}=", v) }
user.staged = false
else