ref: refs/heads/master
commit 27f6f77de7ab75535568a40239b4b250f0910a77
Author: Klaus Kämpf
Date: Fri Jul 17 17:59:54 2009 +0200
Allow to pass error and hostid
Error messages via flash[] do not survive change of controller.
On login failure (session controller), one is pushed back to choose
another host (hosts controller).
So login failures must passed via ?error=
---
webclient/app/controllers/hosts_controller.rb | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/webclient/app/controllers/hosts_controller.rb b/webclient/app/controllers/hosts_controller.rb
index 89e06a9..8ff6c7d 100644
--- a/webclient/app/controllers/hosts_controller.rb
+++ b/webclient/app/controllers/hosts_controller.rb
@@ -3,7 +3,11 @@ require 'uri'
class HostsController < ApplicationController
layout 'main'
+ #
# GET /hosts
+ # Display list of hosts for user to choose (or add)
+ # params :error, :hostid, set if previously choosen host is wrong
+ #
def index
begin
@hosts = Host.find(:all)
@@ -12,6 +16,15 @@ class HostsController < ApplicationController
# show nice error screen and remind to "rake db:migrate"
redirect_to "/migration_missing"
end
+
+ # error is set if session couldn't be established and user has to re-choose the host
+ # flash[] doesn't survive redirects across controllers :-(
+ error = params[:error]
+ if error == "econnrefused"
+ host = Host.find(params[:hostid]) rescue nil
+ flash[:error] = _("Can't connect to host #{host.name}.") if host
+ flash[:warning] = _("Make sure the host is up and that the YaST web service is running.")
+ end
end
# GET /hosts/show/1
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org