# HG changeset patch # User Christophe Lincoln # Date 1389129745 -3600 # Node ID 1fa682f972c9de6f1132c51fc141e343c7bdb046 # Parent 10f3f4d09e0950c3d61e0395b15556ad494a6b76 Add online users in dashboard and misc changes diff -r 10f3f4d09e09 -r 1fa682f972c9 web/bugs.cgi --- a/web/bugs.cgi Tue Jan 07 20:53:30 2014 +0100 +++ b/web/bugs.cgi Tue Jan 07 22:22:25 2014 +0100 @@ -221,8 +221,6 @@ # Display user public profile. public_people() { cat << EOT -
-$(eval_gettext 'Real name  : $NAME')
 
EOT } @@ -230,10 +228,8 @@ # Display authentified user profile. TODO: change password auth_people() { cat << EOT -
-$(eval_gettext 'Real name  : $NAME')
-$(eval_gettext 'Email      : $MAIL')
-$(eval_gettext 'Secure key : $KEY')
+Email      : $MAIL
+Secure key : $KEY
 
EOT } @@ -556,6 +552,8 @@ fi md5session=$(echo -n "$$:$user:$pass:$$" | md5sum | awk '{print $1}') mkdir -p $sessions + # Log last login + date '+%Y-%m-%d' > ${PEOPLE}/${user}/last echo "$md5session" > $sessions/$user js_set_cookie 'auth' "$user:$md5session" js_log "Login authentification has been executed & accepted :)" @@ -638,14 +636,23 @@ fi ;; *\ user\ *) # User profile + last="$(cat $PEOPLE/"$(GET user)"/last)" header html_header user_box . $PEOPLE/"$(GET user)"/account.conf - echo "

$(get_gravatar $MAIL) $(GET user)

" + cat << EOT +

$(get_gravatar $MAIL) $NAME

+ +
+$(gettext "User name  :") $USER
+$(gettext "Last login :") $last
+EOT
 		if check_auth && [ "$(GET user)" == "$user" ]; then
 			auth_people
 		else
+			# check_auth will set VARS to current logged user: re-source
+			. $PEOPLE/"$(GET user)"/account.conf
 			public_people
 		fi
 		html_footer ;;
diff -r 10f3f4d09e09 -r 1fa682f972c9 web/plugins/dashboard/dashboard.cgi
--- a/web/plugins/dashboard/dashboard.cgi	Tue Jan 07 20:53:30 2014 +0100
+++ b/web/plugins/dashboard/dashboard.cgi	Tue Jan 07 22:22:25 2014 +0100
@@ -10,7 +10,7 @@
 		header
 		html_header
 		user_box
-		if ! admin_user; then
+		if check_auth && ! admin_user; then
 			gettext "You must be admin to manage users."
 			exit 0
 		fi
@@ -33,6 +33,26 @@
 			unset NAME USER 
 		done
 		echo "
" && exit 0 ;; + + *\ online\ *) + # Show online users based on sessions files. + d="Online users" + header + html_header + user_box + cat << EOT +

Online users

+
+EOT
+		for u in $(ls $sessions)
+		do
+			. "${PEOPLE}/${u}/account.conf"
+			cat << EOT
+$(get_gravatar $MAIL 24) $USER | $NAME
+EOT
+		done
+		echo "
" + html_footer && exit 0 ;; *\ dashboard\ *) d="Dashboard" @@ -46,8 +66,9 @@ gettext "You must be logged in to view the dashboard." exit 0 fi - if admin_user; then - admintools="Users" + if check_auth && admin_user; then + # Online users should not be public ? + admintools="List users" fi cat << EOT

Dashboard

@@ -57,6 +78,7 @@ Bugsize : $bugsize
+ Online users $admintools

Admin users