Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge remote-tracking branch 'origin/stable' into pkgr
- Loading branch information
Showing
with
5 additions
and
0 deletions.
-
+5
−0
app/controllers/users_controller.rb
|
@@ -292,6 +292,8 @@ def user_from_params_or_current_user |
|
|
params[:for_user_id] ? User.find(params[:for_user_id]) : current_user |
|
|
end |
|
|
|
|
|
FROM_STAGED = "from_staged" |
|
|
|
|
|
def create |
|
|
params.permit(:user_fields) |
|
|
|
|
@@ -314,6 +316,8 @@ def create |
|
|
if user = User.where(staged: true).find_by(email: params[:email].strip.downcase) |
|
|
user_params.each { |k, v| user.send("#{k}=", v) } |
|
|
user.staged = false |
|
|
user.active = false |
|
|
user.custom_fields[FROM_STAGED] = true |
|
|
else |
|
|
user = User.new(user_params) |
|
|
end |
|
@@ -608,6 +612,7 @@ def update_activation_email |
|
|
raise Discourse::InvalidAccess.new unless @user.present? |
|
|
raise Discourse::InvalidAccess.new if @user.active? |
|
|
raise Discourse::InvalidAccess.new if current_user.present? |
|
|
raise Discourse::InvalidAccess.new if @user.custom_fields[FROM_STAGED] |
|
|
|
|
|
User.transaction do |
|
|
@user.email = params[:email] |
|
|