3 # First check that we have a username as $1. If not, ask for the username
6 echo -n "Please enter the login : "
12 # Check that the login exists :
13 MYSQL="mysql --defaults-file=/etc/alternc/my.cnf --skip-column-name alternc -B -e "
15 USERID="`$MYSQL "SELECT uid FROM membres WHERE login='${LOGIN}'"`"
19 echo "Login '$LOGIN' not found"
20 if [ "$LOGIN" = "admin" ]
22 echo "You may try 'root' instead (old alternc)"
24 if [ "$LOGIN" = "root" ]
26 echo "You may try 'admin' instead (new alternc)"
32 echo -n "Please enter the new password : "
35 echo -n "Please confirm the new password : "
38 if [ "$PASS" != "$PASS2" ]
40 echo "Passwords are differents, aborting"
44 RND="`echo -n $RANDOM $RANDOM $RANDOM`"
45 $MYSQL "UPDATE membres SET pass=ENCRYPT('$PASS',CONCAT('\$1\$',MD5('$RND'))) WHERE uid='$USERID'"
48 echo "Password changed successfully"