diff --git a/app/controllers/keys_controller.rb b/app/controllers/keys_controller.rb
index 867a2dced89d55f9cca510231086b805477cdf68..8755890604b6b6edbb6feb6f4a2a0d174fcf6c08 100644
--- a/app/controllers/keys_controller.rb
+++ b/app/controllers/keys_controller.rb
@@ -22,7 +22,8 @@ class KeysController < ApplicationController
     elsif params[:keyfile].present?
       input = params[:keyfile].read
     else
-      redirect_to :index, alert: 'No input found'
+      flash[:alert] = 'No input found'
+      return redirect_to action: 'index'
     end
 
     if ! input.match('BEGIN PGP')