tinycm rev 106
Fix admin_user
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 22 12:22:11 2017 +0100 (2017-02-22) |
parents | ddf5125a4b03 |
children | 5acf8ea65f7d |
files | Makefile index.cgi plugins/users/users.cgi tools/update.sh |
line diff
1.1 --- a/Makefile Mon Feb 20 20:49:00 2017 +0000 1.2 +++ b/Makefile Wed Feb 22 12:22:11 2017 +0100 1.3 @@ -34,7 +34,7 @@ 1.4 install: install-web 1.5 install -m 0700 -d $(DESTDIR)$(AUTH)/people 1.6 install -m 0700 -d $(DESTDIR)$(AUTH)/auth 1.7 - install -m 0777 -d $(DESTDIR)$(PREFIX)/share/locale 1.8 + install -m 0755 -d $(DESTDIR)$(PREFIX)/share/locale 1.9 cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale 1.10 # Set permissions 1.11 chown -R www.www $(DESTDIR)$(AUTH)/auth
2.1 --- a/index.cgi Mon Feb 20 20:49:00 2017 +0000 2.2 +++ b/index.cgi Wed Feb 22 12:22:11 2017 +0100 2.3 @@ -152,7 +152,7 @@ 2.4 2.5 # Check if user is admin 2.6 admin_user() { 2.7 - fgrep -w -q "$user" ${ADMIN_USERS} 2.8 + grep -w -q "$user" ${ADMIN_USERS} 2.9 } 2.10 2.11 # Authenticated or not 2.12 @@ -243,25 +243,18 @@ 2.13 2.14 # Create a new user in AUTH_FILE and PEOPLE 2.15 new_user_config() { 2.16 - if [ ! -f "$AUTH_FILE" ];then 2.17 - touch $AUTH_FILE 2.18 - chmod 0600 $AUTH_FILE 2.19 + if [ ! -f "$AUTH_FILE" ]; then 2.20 + touch $AUTH_FILE && chmod 0600 $AUTH_FILE 2.21 fi 2.22 echo "$user:$pass" >> $AUTH_FILE 2.23 - mkdir -p $PEOPLE/$user/ 2.24 + mkdir -pm0700 $PEOPLE/${user} 2.25 cat > $PEOPLE/$user/account.conf << EOT 2.26 # User configuration 2.27 NAME="$name" 2.28 USER="$user" 2.29 MAIL="$mail" 2.30 EOT 2.31 - cat > $PEOPLE/$user/profile.conf << EOT 2.32 -# User profile 2.33 -WEBSITE="$website" 2.34 -FACEBOOK="$facebook" 2.35 -TWITTER="$twitter" 2.36 -EOT 2.37 - chmod 0600 $PEOPLE/$user/*.conf 2.38 + chmod 0600 $PEOPLE/$user/account.conf 2.39 # First created user is admin 2.40 if [ $(ls ${PEOPLE} | wc -l) == "1" ]; then 2.41 echo "$user" > ${ADMIN_USERS}
3.1 --- a/plugins/users/users.cgi Mon Feb 20 20:49:00 2017 +0000 3.2 +++ b/plugins/users/users.cgi Wed Feb 22 12:22:11 2017 +0100 3.3 @@ -176,14 +176,26 @@ 3.4 user_box 3.5 account_config="$PEOPLE/$(GET user)/account.conf" 3.6 profile_config="$PEOPLE/$(GET user)/profile.conf" 3.7 + 3.8 if [ ! -f "$account_config" ]; then 3.9 echo "No user profile for: $(GET user)" 3.10 html_footer && exit 0 3.11 else 3.12 . ${account_config} 3.13 fi 3.14 - [ -f "$profile_config" ] && . ${profile_config} 3.15 -cat << EOT 3.16 + # Init profile.conf 3.17 + if [ -f "${profile_config}" ]; then 3.18 + . ${profile_config} 3.19 + else 3.20 + cat > $PEOPLE/$user/profile.conf << EOT 3.21 +# User profile 3.22 +WEBSITE="$website" 3.23 +FACEBOOK="$facebook" 3.24 +TWITTER="$twitter" 3.25 +EOT 3.26 + chmod 0600 $PEOPLE/$user/profile.conf 3.27 + fi 3.28 + cat << EOT 3.29 <h2>$(get_gravatar $MAIL) $NAME</h2> 3.30 3.31 <pre>
4.1 --- a/tools/update.sh Mon Feb 20 20:49:00 2017 +0000 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,21 +0,0 @@ 4.4 -#!/bin/sh 4.5 -# 4.6 -# Update a TinyCM install with latest code from Hg. 4.7 -# Usage: ./tools/update.sh [paths] 4.8 -# 4.9 -. /lib/libtaz.sh 4.10 - 4.11 -[ ! "$1" ] && echo "Missing TinyCM path(s)" && exit 0 4.12 - 4.13 -# We dont overwrite style.css and images since they may have changed 4.14 -# as well as the config file! 4.15 -for cm in $@ 4.16 -do 4.17 - echo "Updating: $cm" 4.18 - cp -a index.cgi ${cm} 4.19 - cp -a plugins ${cm} 4.20 - cp -a lib/functions.js ${cm}/lib 4.21 - cp -a lib/jseditor.html ${cm}/lib 4.22 -done 4.23 - 4.24 -exit 0