dologin() { res="$(echo "select username from radcheck where username ='$REMOTE_MAC';" | mysql -u root -pXXXX radius)" if [ "$res" = "" ] then echo "insert into radcheck (username, attribute, op, value) values ('$REMOTE_MAC', 'Cleartext-Password', ':=', 'password');" | mysql -u root -pXXXX radius echo "insert into radusergroup (username, groupname) values ('$REMOTE_MAC', '30min');" | mysql -u root -pXXXX radius fi # url=$(chi_login_url "$FORM_username" "$FORM_password" "$FORM_userurl") url=$(chi_login_url "$REMOTE_MAC" "password" "$FORM_userurl") cat <<ENDHTML <html><head> <meta http-equiv="refresh" content="0;url=$url"/> </head></html> ENDHTML wisprLoginResultsURL "$url" }
Once you have done this, every time a new device logs into your web page, the script will check if the MAC address exists or not. If not it will require any username. I changed my login page to just be a button and made the other fields hidden, like so edit /etc/chilli/www/login_form.tmpl :
<!-- -- The login form --> <div id="login-form"> <table> <tr> <!-- <td>Usernamebb</td> --> <td><INPUT NAME="username" VALUE="user1" TYPE="hidden"></td> </tr> <tr> <!-- <td>Password</td> --> <td><INPUT NAME="password" VALUE="password" TYPE="hidden" TYPE="password"></td> </tr> <tr> <td colspan="2" nowrap align="center"> <input type="submit" name="button" value="Login & Accept Terms"> </td> </tr> </table> </div>