Skip to content
Snippets Groups Projects
Commit bfc8b430 authored by Bob Mottram's avatar Bob Mottram
Browse files

Add qrcode for xmpp to user profile in web UI

parent 83019067
No related branches found
No related tags found
No related merge requests found
......@@ -284,6 +284,13 @@ webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
if [ -d "$webadmin_install_dir" ]; then
pubkey_qrcode="$webadmin_install_dir/images/userprofile_${ADD_USERNAME}.png"
su -c "gpg --armor --export \"$MY_GPG_PUBLIC_KEY_ID\"" - "$ADD_USERNAME" | qrencode -t PNG -o "$pubkey_qrcode"
xmpp_qrcode="$webadmin_install_dir/images/userprofile_${ADD_USERNAME}_xmpp.png"
if [ ! -f /usr/local/bin/myqr ]; then
echo -n "${ADD_USERNAME}@${HOSTNAME}" | qrencode -t PNG -o "$xmpp_qrcode"
else
myqr "${ADD_USERNAME}@${HOSTNAME}" -p /root/freedombone/img/android-app/xmpp.png -c -n "$xmpp_qrcode"
fi
fi
echo "Notifying"
......
......@@ -148,6 +148,20 @@ fi
echo "Updating web admin"
web_admin_create_users
# create qrcode for the user's public key
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
if [ -d "$webadmin_install_dir" ]; then
pubkey_qrcode="$webadmin_install_dir/images/userprofile_${REMOVE_USERNAME}.png"
if [ -f "$pubkey_qrcode" ]; then
rm "$pubkey_qrcode"
fi
xmpp_qrcode="$webadmin_install_dir/images/userprofile_${REMOVE_USERNAME}_xmpp.png"
if [ -f "$xmpp_qrcode" ]; then
rm "$xmpp_qrcode"
fi
fi
echo "Notifying"
${PROJECT_NAME}-notification -m $"User $REMOVE_USERNAME was removed $(date)" -s $"[${PROJECT_NAME}] User removed"
echo $"User $REMOVE_USERNAME was removed"
......
......@@ -137,6 +137,13 @@ function web_admin_create_users {
fi
fi
fi
xmpp_qrcode="$webadmin_install_dir/images/userprofile_${USERNAME}_xmpp.png"
if [ ! -f /usr/local/bin/myqr ]; then
echo -n "${useremail}" | qrencode -t PNG -o "$xmpp_qrcode"
else
myqr "${useremail}" -p /root/freedombone/img/android-app/xmpp.png -c -n "$xmpp_qrcode"
fi
pubkey_qrcode="$webadmin_install_dir/images/userprofile_${USERNAME}.png"
su -c "gpg --armor --export \"$GPG_ID\"" - "$USERNAME" | qrencode -t PNG -o "$pubkey_qrcode"
......@@ -155,7 +162,7 @@ function web_admin_create_users {
else
sed -i "s|USERTYPE|User|g" "$userfile"
fi
sed -i "s|USEREMAIL|${useremail}|g" "$userfile"
sed -i "s|USEREMAIL|<a href=\"userprofile_${USERNAME}_xmpp.png\">${useremail}</a>|g" "$userfile"
sed -i "s|USERGPG|${GPG_ID}|g" "$userfile"
chown www-data:www-data "$userfile"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment