diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e25615b..3053575 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,11 +48,7 @@ class ApplicationController < ActionController::Base helper_method :page_title def redirect_to_with_return_to(url, *args) - if params[:return_to].blank? || !params[:return_to].starts_with?("/") - redirect_to url_with_return_to(url), *args - else - redirect_to url_with_return_to(url), *args - end + redirect_to url_with_return_to(url), *args end def set_timezone diff --git a/lib/postal/smtp_server/server.rb b/lib/postal/smtp_server/server.rb index 17fb2e1..9905239 100644 --- a/lib/postal/smtp_server/server.rb +++ b/lib/postal/smtp_server/server.rb @@ -159,13 +159,11 @@ module Postal # The client is not negotiating a TLS handshake at this time begin # Read 10kiB of data at a time from the socket. + buffers[io] << io.readpartial(10_240) + # There is an extra step for SSL sockets - case io - when OpenSSL::SSL::SSLSocket - buffers[io] << io.readpartial(10_240) + if io.is_a?(OpenSSL::SSL::SSLSocket) buffers[io] << io.readpartial(10_240) while io.pending.positive? - else - buffers[io] << io.readpartial(10_240) end rescue EOFError, Errno::ECONNRESET, Errno::ETIMEDOUT # Client went away @@ -280,12 +278,14 @@ module Postal end # If we have been spawned to replace an existing processm shut down the # parent after listening. + # rubocop:disable Style/IdenticalConditionalBranches if ENV["SERVER_FD"] listen - kill_parent + kill_parent if ENV["SERVER_FD"] else listen end + # rubocop:enable Style/IdenticalConditionalBranches run_event_loop end diff --git a/lib/postal/user_creator.rb b/lib/postal/user_creator.rb index 3928676..502da82 100644 --- a/lib/postal/user_creator.rb +++ b/lib/postal/user_creator.rb @@ -18,18 +18,16 @@ module Postal user.password = cli.ask("Initial Password".ljust(20, " ") + ": ") { |value| value.echo = "*" } block.call(user) if block_given? + puts if user.save - puts puts "User has been created with e-mail address \e[32m#{user.email_address}\e[0m" - puts else - puts puts "\e[31mFailed to create user\e[0m" for error in user.errors.full_messages puts " * #{error}" end - puts end + puts end end