FEATURE: can take over a staged account

This commit is contained in:
Régis Hanol
2015-11-13 19:07:28 +01:00
parent a682ec9444
commit 43614439e6
2 changed files with 17 additions and 1 deletions

View File

@ -259,7 +259,12 @@ class UsersController < ApplicationController
return fail_with("login.reserved_username")
end
user = User.new(user_params)
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
else
user = User.new(user_params)
end
# Handle custom fields
user_fields = UserField.all