#1019 Add email field to web integration sample
This commit is contained in:
@@ -54,16 +54,18 @@ abstract class AuthMeController {
|
||||
*
|
||||
* @param string $username the username to register
|
||||
* @param string $password the password to associate to the user
|
||||
* @param string $email the email (may be empty)
|
||||
* @return bool whether or not the registration was successful
|
||||
*/
|
||||
function register($username, $password) {
|
||||
function register($username, $password, $email) {
|
||||
$email = $email ? $email : 'your@email.com';
|
||||
$mysqli = $this->getAuthmeMySqli();
|
||||
if ($mysqli !== null) {
|
||||
$hash = $this->hash($password);
|
||||
$stmt = $mysqli->prepare('INSERT INTO ' . self::AUTHME_TABLE . ' (username, realname, password, ip) '
|
||||
. 'VALUES (?, ?, ?, ?)');
|
||||
$stmt = $mysqli->prepare('INSERT INTO ' . self::AUTHME_TABLE . ' (username, realname, password, email, ip) '
|
||||
. 'VALUES (?, ?, ?, ?, ?)');
|
||||
$username_low = strtolower($username);
|
||||
$stmt->bind_param('ssss', $username, $username_low, $hash, $_SERVER['REMOTE_ADDR']);
|
||||
$stmt->bind_param('sssss', $username, $username_low, $hash, $email, $_SERVER['REMOTE_ADDR']);
|
||||
return $stmt->execute();
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user