app/controllers/symphonia/accounts_controller.rb in symphonia-3.0.3 vs app/controllers/symphonia/accounts_controller.rb in symphonia-3.1.0
- old
+ new
@@ -21,21 +21,21 @@
end
def create
menu_item(:register)
@user.attributes = user_params
- if Symphonia.config[:self_activation_enabled]
- @user.status = @user.class.statuses[:active]
- else
- @user.status = @user.class.statuses[:pending]
- end
+ @user.status = if Symphonia.config[:self_activation_enabled]
+ @user.class.statuses[:active]
+ else
+ @user.class.statuses[:pending]
+ end
respond_to do |format|
verified = if defined?(Recaptcha)
- @user.valid? && verify_recaptcha(model: @user)
- else
- true
- end
+ @user.valid? && verify_recaptcha(model: @user)
+ else
+ true
+ end
if verified && @user.save
Notifier.activation_user(@user).deliver_now
Notifier.user_registered(@user).deliver_now
format.html { redirect_to '/', notice: t(:text_user_registered) }
format.json { render status: :created }
@@ -111,11 +111,11 @@
def reset_password
@user = find_account_by_token(params.require(:id))
return render_404 if @user.nil?
- if params[:password]# && params[:password_confirmation]
+ if params[:password] # && params[:password_confirmation]
@user.password = params[:password]
# @user.password_confirmation = params[:password_confirmation]
end
if @user.changed? && @user.save
@@ -143,14 +143,15 @@
private
def prepare_user
return render_403 unless Symphonia.config[:allow_registrations]
+
@user = User.new
end
def user_params
- params.require(:user).permit(:login, :first_name, :last_name, :password, :password_confirmation, :email, :mail, preference_ids: [])
+ params.require(:user).permit(:login, :name, :first_name, :last_name, :password, :password_confirmation, :email, :mail, preference_ids: [])
end
def current_account
User.current
end