tazbug rev 118
Up plugins/users and small improvments to dashboard
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Feb 11 22:27:47 2017 +0100 (2017-02-11) |
parents | 73dde38a42cf |
children | 39a59a1271e5 |
files | web/bugs.cgi web/plugins/dashboard/dashboard.cgi web/plugins/users/users.cgi web/plugins/users/users.conf |
line diff
1.1 --- a/web/bugs.cgi Sat Feb 11 15:32:56 2017 +0100 1.2 +++ b/web/bugs.cgi Sat Feb 11 22:27:47 2017 +0100 1.3 @@ -177,7 +177,6 @@ 1.4 # Link for online signup if enabled. 1.5 online_signup() { 1.6 if [ "$ONLINE_SIGNUP" == "yes" ]; then 1.7 - echo -n "<p>" && gettext "Or:"; echo -n " " 1.8 echo -n "<a href='$script?signup&online'>" 1.9 gettext "Sign Up Online" 1.10 echo '</a></p>' 1.11 @@ -190,8 +189,7 @@ 1.12 <h2>$(gettext 'Login')</h2> 1.13 1.14 <div id="account-info"> 1.15 -<p>$(gettext "No account yet? You can signup using the SliTaz Bugs reporter \ 1.16 -on your SliTaz system.")</p> 1.17 +<p>$(gettext "No account yet?")</p> 1.18 $(online_signup) 1.19 <p>$(gettext "Tip: to attach big files or images, you can use SliTaz Paste \ 1.20 services:") <a href="http://paste.slitaz.org/">paste.slitaz.org</a></p> 1.21 @@ -551,7 +549,7 @@ 1.22 pass="$(GET pass)" 1.23 echo "Creating Server Key..." 1.24 fi 1.25 - key=$(echo -n "$user:$mail:$pass" | md5sum | awk '{print $1}') 1.26 + #key=$(echo -n "$user:$mail:$pass" | md5sum | awk '{print $1}') 1.27 echo "$user:$pass" >> $AUTH_FILE 1.28 mkdir -pm0700 $PEOPLE/$user/ 1.29 cat > $PEOPLE/$user/account.conf << EOT 1.30 @@ -561,7 +559,6 @@ 1.31 NAME="$name" 1.32 USER="$user" 1.33 MAIL="$mail" 1.34 -KEY="$key" 1.35 1.36 LOCATION="$(GET location)" 1.37 RELEASES="$(GET releases)" 1.38 @@ -754,56 +751,17 @@ 1.39 html_footer ;; 1.40 *\ signup\ *) 1.41 # Signup 1.42 - if [ "$(GET online)" ];then 1.43 - header 1.44 - html_header 1.45 - user_box 1.46 - echo "<h2>$(gettext "Sign Up")</h2>" 1.47 - if [ "$ONLINE_SIGNUP" == "yes" ]; then 1.48 - signup_page 1.49 - else 1.50 - gettext "Online registration is disabled" 1.51 - fi 1.52 - html_footer && exit 0 1.53 + header 1.54 + html_header 1.55 + user_box 1.56 + echo "<h2>$(gettext "Sign Up")</h2>" 1.57 + if [ "$ONLINE_SIGNUP" == "yes" ]; then 1.58 + signup_page 1.59 else 1.60 - header "Content-type: text/plain;" 1.61 - user="$(GET signup)" 1.62 - echo "Requested user login : $user" 1.63 - if fgrep -q "$user:" $AUTH_FILE; then 1.64 - echo "ERROR: User already exists" && exit 1 1.65 - else 1.66 - echo "Creating account for : $(GET name)" 1.67 - new_user_config 1.68 - fi 1.69 - fi ;; 1.70 - *\ key\ *) 1.71 - # Let user post new bug or message with crypted key (no gettext) 1.72 - # 1.73 - # Testing only and is security acceptable ? 1.74 - # 1.75 - key="$(GET key)" 1.76 - id="$(GET bug)" 1.77 - header "Content-type: text/plain;" 1.78 - echo "Checking secure key..." 1.79 - if fgrep -qH $key $PEOPLE/*/account.conf; then 1.80 - conf=$(fgrep -H $key $PEOPLE/*/account.conf | cut -d ":" -f 1) 1.81 - . $conf 1.82 - echo "Authenticated: $NAME ($USER)" 1.83 - case " $(GET) " in 1.84 - *\ msg\ *) 1.85 - [ ! "$id" ] && echo "Missing bug ID" && exit 0 1.86 - echo "Posting new message to bug: $id" 1.87 - echo "Message: $(GET msg)" 1.88 - new_msg ;; 1.89 - *\ bug\ *) 1.90 - echo "Adding new bug: $(GET bug)" 1.91 - echo "Description: $(GET desc)" 1.92 - new_bug ;; 1.93 - esac 1.94 - else 1.95 - echo "Not a valid SliTaz user key" 1.96 - exit 0 1.97 - fi ;; 1.98 + gettext "Online registration is disabled" 1.99 + fi 1.100 + html_footer ;; 1.101 + 1.102 *\ search\ *) 1.103 found=0 1.104 header
2.1 --- a/web/plugins/dashboard/dashboard.cgi Sat Feb 11 15:32:56 2017 +0100 2.2 +++ b/web/plugins/dashboard/dashboard.cgi Sat Feb 11 22:27:47 2017 +0100 2.3 @@ -12,7 +12,6 @@ 2.4 gettext "You must be logged in to view the dashboard" 2.5 exit 0 2.6 fi 2.7 - users=$(ls -1 $PEOPLE | wc -l) 2.8 bugs=$(ls -1 $bugdir | wc -l) 2.9 bugsize=$(du -sh $bugdir | awk '{print $1}') 2.10 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS 2.11 @@ -36,7 +35,6 @@ 2.12 <pre> 2.13 Bugs count : $bugs 2.14 Database size : $bugsize 2.15 -User accounts : $users 2.16 Server uptime :$(uptime | cut -d "," -f 1-2) 2.17 </pre> 2.18
3.1 --- a/web/plugins/users/users.cgi Sat Feb 11 15:32:56 2017 +0100 3.2 +++ b/web/plugins/users/users.cgi Sat Feb 11 22:27:47 2017 +0100 3.3 @@ -39,6 +39,32 @@ 3.4 html_header 3.5 user_box 3.6 if check_auth && ! admin_user; then 3.7 + gettext "You must be admin to manage users" && exit 0 3.8 + fi 3.9 + cat << EOT 3.10 +<h2>Users admin</h2> 3.11 +<div id="tools"> 3.12 + <a href="$script?dashboard">Dashboard</a> 3.13 + <a href='$script?loggedusers'>Logged users</a> 3.14 + <a href='$script?userslist'>Users list</a> 3.15 +</div> 3.16 +<pre> 3.17 +User accounts : $(ls -1 $PEOPLE | wc -l) 3.18 +Logged users : $(ls $sessions | wc -l) 3.19 +People DB : $PEOPLE 3.20 +Auth file : $AUTH_FILE 3.21 +EOT 3.22 + 3.23 + echo "</pre>" 3.24 + html_footer && exit 0 ;; 3.25 + 3.26 + *\ userslist\ *) 3.27 + # List all users (slow if a llots a of accounts) 3.28 + d="Users" 3.29 + header 3.30 + html_header 3.31 + user_box 3.32 + if check_auth && ! admin_user; then 3.33 gettext "You must be admin to manage users" 3.34 exit 0 3.35 fi 3.36 @@ -47,7 +73,8 @@ 3.37 <h2>Users: $users</h2> 3.38 <div id="tools"> 3.39 <a href="$script?dashboard">Dashboard</a> 3.40 - <a href='?logged'>Logged users</a> 3.41 + <a href="$script?users">Users admin</a> 3.42 + <a href='$script?loggedusers'>Logged users</a> 3.43 </div> 3.44 <pre> 3.45 EOT 3.46 @@ -62,14 +89,14 @@ 3.47 cat << EOT 3.48 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME | $MAIL 3.49 EOT 3.50 -# deluser link 3.51 +# deluser link --> use 'tazu' on SliTaz 3.52 #: <a href="?users&deluser=$USER">$(gettext "delete")</a> 3.53 unset NAME USER 3.54 done 3.55 echo "</pre>" 3.56 html_footer && exit 0 ;; 3.57 3.58 - *\ logged\ *) 3.59 + *\ loggedusers\ *) 3.60 # Show online users based on sessions files. 3.61 d="Logged users" 3.62 header 3.63 @@ -79,10 +106,12 @@ 3.64 gettext "You must be logged in to view online users" 3.65 exit 0 3.66 fi 3.67 + logged="$(ls $sessions | wc -l)" 3.68 cat << EOT 3.69 -<h2>Logged users</h2> 3.70 +<h2>Logged users: $logged</h2> 3.71 <div id="tools"> 3.72 <a href="$script?dashboard">Dashboard</a> 3.73 + <a href="$script?users">Users admin</a> 3.74 </div> 3.75 <pre> 3.76 EOT 3.77 @@ -126,7 +155,7 @@ 3.78 html_footer && exit 0 ;; 3.79 3.80 *\ modprofile\ *) 3.81 - # Let user edit there profile 3.82 + # Let user edit their profile 3.83 if ! check_auth; then 3.84 echo "ERROR" && exit 0 3.85 fi
4.1 --- a/web/plugins/users/users.conf Sat Feb 11 15:32:56 2017 +0100 4.2 +++ b/web/plugins/users/users.conf Sat Feb 11 22:27:47 2017 +0100 4.3 @@ -6,9 +6,9 @@ 4.4 4.5 # Authenticated users 4.6 PLUGINS_TOOLS="${PLUGINS_TOOLS}" 4.7 -DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?logged'>Logged users</a>" 4.8 +DASHBOARD_TOOLS="${DASHBOARD_TOOLS}" 4.9 4.10 # Admin only in Dashboard 4.11 -ADMIN_TOOLS="${ADMIN_TOOLS} <a href='?users'>List users</a>" 4.12 +ADMIN_TOOLS="${ADMIN_TOOLS} <a href='?users'>Users</a>" 4.13 4.14 # Configurable variables used in plugin.cgi