Fix cookie parsing if more than one cookie present, add optional user/loggin-info sidebar
This commit is contained in:
parent
ec151a9902
commit
0fcaff04fe
1 changed files with 9 additions and 7 deletions
|
|
@ -136,12 +136,9 @@ fn set_cookie {
|
||||||
fn get_cookie {
|
fn get_cookie {
|
||||||
ifs=';' { co = `{ echo $HTTP_COOKIE } }
|
ifs=';' { co = `{ echo $HTTP_COOKIE } }
|
||||||
|
|
||||||
#for(c in $co)
|
# XXX: we might be adding a trailing new line?
|
||||||
# if(~ $c $1^'='*) # This matching doesn't work
|
# The ' ?' is needed to deal with '; ' inter-cookie delimiter
|
||||||
# echo $c|sed 's/[^=]*=//'
|
{ for(c in $co) echo $c } | sed -n 's/^ ?'$1'=//p'
|
||||||
|
|
||||||
# WARNING: we might be adding a trailing new line
|
|
||||||
{ for(c in $co) echo $c } | sed -n 's/[^=]*=//p'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_mime {
|
fn select_mime {
|
||||||
|
|
@ -189,7 +186,7 @@ fn login_user {
|
||||||
# Check loggin status, if called with group arg we check membership too
|
# Check loggin status, if called with group arg we check membership too
|
||||||
fn check_user {
|
fn check_user {
|
||||||
if(! get_user)
|
if(! get_user)
|
||||||
status='Not logged in'
|
status='Not logged in:' $status
|
||||||
if not if(~ $#1 1 && ! grep -s '^'^$logged_user^'$' etc/groups/$1)
|
if not if(~ $#1 1 && ! grep -s '^'^$logged_user^'$' etc/groups/$1)
|
||||||
status=User $logged_user not in group $1
|
status=User $logged_user not in group $1
|
||||||
if not
|
if not
|
||||||
|
|
@ -240,6 +237,11 @@ fn auth_user {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn user_controls {
|
||||||
|
echo User: $"logged_user
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# .md '(meta-)data' extract
|
# .md '(meta-)data' extract
|
||||||
fn get_md_file_attr {
|
fn get_md_file_attr {
|
||||||
sed -n '/^\* '$2': /p; /^\* '$2': /q; /^$/q' < $1
|
sed -n '/^\* '$2': /p; /^\* '$2': /q; /^$/q' < $1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue