tazbug rev 73
Fix js redirection and cookies
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Jan 20 00:20:03 2014 +0100 (2014-01-20) |
parents | 00b8f6d05cd7 |
children | 88655776f9ff |
files | web/bugs.cgi web/style.css |
line diff
1.1 --- a/web/bugs.cgi Wed Jan 15 01:02:13 2014 +0100 1.2 +++ b/web/bugs.cgi Mon Jan 20 00:20:03 2014 +0100 1.3 @@ -85,17 +85,21 @@ 1.4 name=$1 1.5 value=$2 1.6 js_log 'Setting cookie.' 1.7 - echo "<script type=\"text/javascript\">" 1.8 - echo "document.cookie = \"$name=$value; expires=0; path=/\""; 1.9 - echo "</script>" 1.10 + cat << EOT 1.11 +<script type="text/javascript"> 1.12 + document.cookie = '$name=$value; expires=0; path=/'; 1.13 + </script> 1.14 +EOT 1.15 } 1.16 1.17 js_unset_cookie() { 1.18 name=$1 1.19 js_log 'Unsetting cookie.' 1.20 - echo "<script type=\"text/javascript\">" 1.21 - echo "document.cookie = \"$1=\"\"; expires=-1; path=/"; 1.22 - echo "</script>" 1.23 + cat << EOT 1.24 +<script type="text/javascript"> 1.25 + document.cookie = '$1=""; expires=-1; path=/;' 1.26 +</script> 1.27 +EOT 1.28 } 1.29 1.30 # Check if user is auth 1.31 @@ -187,7 +191,6 @@ 1.32 1.33 # Login page 1.34 login_page() { 1.35 - 1.36 IDLOC="" 1.37 if [[ "$(GET id)" ]] ;then 1.38 IDLOC="?id=$(GET id)" 1.39 @@ -208,6 +211,7 @@ 1.40 <input type="text" name="auth" placeholder="$(gettext 'User name')" /> 1.41 <input type="password" name="pass" placeholder="$(gettext 'Password')" /> 1.42 <div> 1.43 + <input type="hidden" name="id" value="$(GET id)" /> 1.44 <input type="submit" value="$(gettext 'Log in')" /> 1.45 $error 1.46 </div> 1.47 @@ -459,7 +463,6 @@ 1.48 EOT 1.49 } 1.50 1.51 - 1.52 save_bug() { 1.53 bug="$(GET bug)" 1.54 content="$(GET bugconf)" 1.55 @@ -534,8 +537,8 @@ 1.56 pass="$(echo -n "$(POST pass)" | md5sum | awk '{print $1}')" 1.57 1.58 IDLOC="" 1.59 - if [[ "$(GET id)" ]] ;then 1.60 - IDLOC="&id=$(GET id)" 1.61 + if [[ "$(POST id)" ]] ;then 1.62 + IDLOC="&id=$(POST id)" 1.63 fi 1.64 1.65 if [ ! -f $AUTH_FILE ] ; then 1.66 @@ -545,8 +548,8 @@ 1.67 1.68 valid=$(fgrep "${user}:" $AUTH_FILE | cut -d ":" -f 2) 1.69 if [ "$pass" == "$valid" ] && [ "$pass" != "" ]; then 1.70 - if [[ "$(GET id)" ]] ;then 1.71 - IDLOC="?id=$(GET id)" 1.72 + if [[ "$(POST id)" ]] ;then 1.73 + IDLOC="?id=$(POST id)" 1.74 fi 1.75 md5session=$(echo -n "$$:$user:$pass:$$" | md5sum | awk '{print $1}') 1.76 mkdir -p $sessions 1.77 @@ -583,6 +586,7 @@ 1.78 # 1.79 # Plugins Now! 1.80 # 1.81 + 1.82 for p in $(ls -1 $plugins) 1.83 do 1.84 [ -f "$plugins/$p/$p.conf" ] && . $plugins/$p/$p.conf 1.85 @@ -799,6 +803,7 @@ 1.86 header 1.87 html_header 1.88 user_box 1.89 + 1.90 cat << EOT 1.91 1.92 <h2>$(gettext "Summary")</h2>