#!/bin/sh
. /etc/sargraph.conf
##add_user ver3.0
##This script will be used to add users inorder to access SARGRAPH
echo "Enter Firstname:"
read fname
echo "Enter Lastname:"
read lname
echo "Enter Username:"
read user
grep $user $USERCONF
if [ $? -eq 0 ]
then
echo "ERROR: User already exist, exiting!"
exit
fi
echo "Enter Password:"
read pass1
echo "Confirm Password:"
read pass2
if [ "$pass1" = "$pass2" ];
then
pass1=`echo $user$pass1 | md5sum | cut -b 1-8`
echo "$user:$pass1:$fname:$lname" >> $USERCONF
echo "$user added"
else
echo "ERROR: Password not matching"
fi
