# HG changeset patch # User Christophe Lincoln # Date 1487762531 -3600 # Node ID 511841d477a381dc1a2c40ddb4e507f1a1ffd017 # Parent ddf5125a4b038545a8729d0a84db8c9a0eae5e99 Fix admin_user diff -r ddf5125a4b03 -r 511841d477a3 Makefile --- a/Makefile Mon Feb 20 20:49:00 2017 +0000 +++ b/Makefile Wed Feb 22 12:22:11 2017 +0100 @@ -34,7 +34,7 @@ install: install-web install -m 0700 -d $(DESTDIR)$(AUTH)/people install -m 0700 -d $(DESTDIR)$(AUTH)/auth - install -m 0777 -d $(DESTDIR)$(PREFIX)/share/locale + install -m 0755 -d $(DESTDIR)$(PREFIX)/share/locale cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale # Set permissions chown -R www.www $(DESTDIR)$(AUTH)/auth diff -r ddf5125a4b03 -r 511841d477a3 index.cgi --- a/index.cgi Mon Feb 20 20:49:00 2017 +0000 +++ b/index.cgi Wed Feb 22 12:22:11 2017 +0100 @@ -152,7 +152,7 @@ # Check if user is admin admin_user() { - fgrep -w -q "$user" ${ADMIN_USERS} + grep -w -q "$user" ${ADMIN_USERS} } # Authenticated or not @@ -243,25 +243,18 @@ # Create a new user in AUTH_FILE and PEOPLE new_user_config() { - if [ ! -f "$AUTH_FILE" ];then - touch $AUTH_FILE - chmod 0600 $AUTH_FILE + if [ ! -f "$AUTH_FILE" ]; then + touch $AUTH_FILE && chmod 0600 $AUTH_FILE fi echo "$user:$pass" >> $AUTH_FILE - mkdir -p $PEOPLE/$user/ + mkdir -pm0700 $PEOPLE/${user} cat > $PEOPLE/$user/account.conf << EOT # User configuration NAME="$name" USER="$user" MAIL="$mail" EOT - cat > $PEOPLE/$user/profile.conf << EOT -# User profile -WEBSITE="$website" -FACEBOOK="$facebook" -TWITTER="$twitter" -EOT - chmod 0600 $PEOPLE/$user/*.conf + chmod 0600 $PEOPLE/$user/account.conf # First created user is admin if [ $(ls ${PEOPLE} | wc -l) == "1" ]; then echo "$user" > ${ADMIN_USERS} diff -r ddf5125a4b03 -r 511841d477a3 plugins/users/users.cgi --- a/plugins/users/users.cgi Mon Feb 20 20:49:00 2017 +0000 +++ b/plugins/users/users.cgi Wed Feb 22 12:22:11 2017 +0100 @@ -176,14 +176,26 @@ user_box account_config="$PEOPLE/$(GET user)/account.conf" profile_config="$PEOPLE/$(GET user)/profile.conf" + if [ ! -f "$account_config" ]; then echo "No user profile for: $(GET user)" html_footer && exit 0 else . ${account_config} fi - [ -f "$profile_config" ] && . ${profile_config} -cat << EOT + # Init profile.conf + if [ -f "${profile_config}" ]; then + . ${profile_config} + else + cat > $PEOPLE/$user/profile.conf << EOT +# User profile +WEBSITE="$website" +FACEBOOK="$facebook" +TWITTER="$twitter" +EOT + chmod 0600 $PEOPLE/$user/profile.conf + fi + cat << EOT

$(get_gravatar $MAIL) $NAME

diff -r ddf5125a4b03 -r 511841d477a3 tools/update.sh
--- a/tools/update.sh	Mon Feb 20 20:49:00 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# Update a TinyCM install with latest code from Hg.
-# Usage: ./tools/update.sh [paths]
-#
-. /lib/libtaz.sh
-
-[ ! "$1" ] && echo "Missing TinyCM path(s)" && exit 0
-
-# We dont overwrite style.css and images since they may have changed
-# as well as the config file!
-for cm in $@
-do
-	echo "Updating: $cm"
-	cp -a index.cgi ${cm}
-	cp -a plugins ${cm}
-	cp -a lib/functions.js ${cm}/lib
-	cp -a lib/jseditor.html ${cm}/lib
-done
-
-exit 0