tazbug diff web/bugs.cgi @ rev 123
Use new admin config and up users plugins from TinyCM
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Feb 21 00:51:31 2017 +0100 (2017-02-21) |
parents | b19dbd851223 |
children | 4dab1a5b9cb6 |
line diff
1.1 --- a/web/bugs.cgi Sat Feb 11 22:27:47 2017 +0100 1.2 +++ b/web/bugs.cgi Tue Feb 21 00:51:31 2017 +0100 1.3 @@ -4,7 +4,7 @@ 1.4 # 1.5 # Copyright (C) 2012-2017 SliTaz GNU/Linux - BSD License 1.6 # 1.7 -. /usr/lib/slitaz/httphelper 1.8 +. /usr/lib/slitaz/httphelper.sh 1.9 1.10 # Source config file 1.11 . ./config.cgi 1.12 @@ -112,7 +112,7 @@ 1.13 1.14 # Check if user is admin 1.15 admin_user() { 1.16 - fgrep -q 'ADMIN_USER="yes"' ${PEOPLE}/${user}/account.conf 1.17 + fgrep -w -q "$user" ${ADMIN_USERS} 1.18 } 1.19 1.20 # Authenticated or not 1.21 @@ -543,30 +543,21 @@ 1.22 1.23 # Create a new user in AUTH_FILE and PEOPLE 1.24 new_user_config() { 1.25 - if [ ! "$online" ]; then 1.26 - name="$(GET name)" 1.27 - mail="$(GET mail)" 1.28 - pass="$(GET pass)" 1.29 - echo "Creating Server Key..." 1.30 + if [ ! -f "$AUTH_FILE" ]; then 1.31 + touch $AUTH_FILE && chmod 0600 $AUTH_FILE 1.32 fi 1.33 - #key=$(echo -n "$user:$mail:$pass" | md5sum | awk '{print $1}') 1.34 echo "$user:$pass" >> $AUTH_FILE 1.35 - mkdir -pm0700 $PEOPLE/$user/ 1.36 + mkdir -pm0700 $PEOPLE/${user} 1.37 cat > $PEOPLE/$user/account.conf << EOT 1.38 -# SliTaz user configuration 1.39 -# 1.40 - 1.41 +# User configuration 1.42 NAME="$name" 1.43 USER="$user" 1.44 MAIL="$mail" 1.45 - 1.46 -LOCATION="$(GET location)" 1.47 -RELEASES="$(GET releases)" 1.48 -PACKAGES="$(GET packages)" 1.49 EOT 1.50 chmod 0600 $PEOPLE/$user/account.conf 1.51 - if [ ! -f $PEOPLE/$user/account.conf ]; then 1.52 - echo "ERROR: User creation failed!" 1.53 + # First created user is admin 1.54 + if [ $(ls ${PEOPLE} | wc -l) == "1" ]; then 1.55 + echo "$user" > ${ADMIN_USERS} 1.56 fi 1.57 } 1.58