From b9c86afd38e95fa6b21eef77164c1069f31dc076 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Fri, 23 Sep 2011 11:20:19 +0200 Subject: [PATCH] Feature #795: Added special x509 sunstone login screen. Does not show username field and password field. (cherry picked from commit 015df5c95648680d225fc7f5e6683fdade48c7c5) --- src/sunstone/public/images/panel_short.png | Bin 0 -> 1825 bytes src/sunstone/sunstone-server.rb | 15 ++++--- src/sunstone/templates/login_x509.html | 47 +++++++++++++++++++++ 3 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 src/sunstone/public/images/panel_short.png create mode 100644 src/sunstone/templates/login_x509.html diff --git a/src/sunstone/public/images/panel_short.png b/src/sunstone/public/images/panel_short.png new file mode 100644 index 0000000000000000000000000000000000000000..2eb300fe1fbc9ce1782fd1be8375fe607eb30578 GIT binary patch literal 1825 zcmb`IZB)`(8o>W#`IhFAr==`)hOu?B#%#^dP_g9)qd~+q$z2O6-y#r6l#~p74YZM1n)y8QW#-;<@9*B{-20s0hkKq| z{3QY7?&{?V0DwC-1|$Liglb=NogMA-1e9p819Fy#IS2^)w;AjkNAh6|2-rUMTaw0d zd&GqnlW-OQ)_Z;&5TN?zW_!@-92SpuQoF!h{uDwv^8IW3#X2l_AU<1V)SxoT4c=Yz z+EdbEPv--a5F&TYH)6eC-@V>u*;s6w|S*Y|IH-lWy1^JON zucp)D%2>Hd;;`$;!!z%=(YG_H`T48&xm<28=$4vrEj8gUDnRpXwO@i*Lq*(>S2Q#< z=nVz~lF#R#f(mO}$hpt^c=t44jQ%e&PW33~t_Pk#V6y0RGrzdFc=zDm2;EW09KF50 zz1qVk{MhyC>K~aiBh4%{7!0qS;%`DulpB>H`*JkvWH_eEr|(fgDwS&DR8>`JOG`?u zKMaEjl&|XEeE*Zqo6q+t}>?BmF*45R0CJdhc zJbGkU(oNbSL!RF2HPw-~_7=*~$;m_U^yz94U9fvZr!Vr^*|MH7Z%qe>uK1!pG&QfC z<{fDy;3uC43J}*kh9fZB(W0G28@&IjcAUO_8&k^MxEob-A~s5wF1ZXzDoII6zFz8PjmPK>5TX#-|weg&F?9u`AD+ zk(LL%-;FK1Gc=yTD7Ea*O-M@mX=LA;CB_3w}-xF+a0-FKGl20`zQV5$B$8PT_zaLVW;hww7(wXD!cRHy?YD!IXNq* z)Go9+lSXWrDk&+UK!sdhJ7Pj#*f+h&q>CBrUoT~@EaN?EH|Lp8m!I zD)fRX79G#@3K$jf$%|eU$}KniJbWWZ!*doUCBc;b)o^UtkagoB$qXgp!fLd?l~~Uw znH=six;WX4BvRbV*^MSDG>%@=2T>+>aH1GG_YV_F7O+(>Z3`4E^?&>}uxJ7(IQaK( F{|`jgVDA6` literal 0 HcmV?d00001 diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 49e99f831b..e2bc06ab93 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -52,13 +52,12 @@ require 'SunstonePlugins' begin conf = YAML.load_file(CONFIGURATION_FILE) + conf[:hash_passwords] = true rescue Exception => e puts "Error parsing config file #{CONFIGURATION_FILE}: #{e.message}" exit 1 end -conf[:hash_passwords] = true - ############################################################################## # Sinatra Configuration ############################################################################## @@ -144,9 +143,10 @@ end # HTML Requests ############################################################################## get '/' do - return File.read(File.dirname(__FILE__)+ - '/templates/login.html') unless authorized? - + if !authorized? + templ = settings.config[:auth]=="basic"? "login.html" : "login_x509.html" + return File.read(File.dirname(__FILE__)+'/templates/'+templ) + end time = Time.now + 60 response.set_cookie("one-user", :value=>"#{session[:user]}", @@ -165,7 +165,10 @@ get '/' do end get '/login' do - File.read(SUNSTONE_ROOT_DIR+'/templates/login.html') + if !authorized? + templ = settings.confing[:auth]=="basic"? "login.html" : "login_x509.html" + return File.read(File.dirname(__FILE__)+'/templates/'+templ) + end end ############################################################################## diff --git a/src/sunstone/templates/login_x509.html b/src/sunstone/templates/login_x509.html new file mode 100644 index 0000000000..790e52028c --- /dev/null +++ b/src/sunstone/templates/login_x509.html @@ -0,0 +1,47 @@ + + + + OpenNebula Sunstone Login + + + + + + + + + + + + + + + +
+
+
+ +
+ Invalid username or password +
+
+ OpenNebula is not running +
+ +
+
+
+ + + + +
+
+
+
+ +