Fixed the mysql auth include and the db schema. I set the desc field to be a varchar(200) and set it to be NULL by default (this is a personal preference but since it was not set in the code...). I fixed adduser function in html/includes/authentication/mysql.inc.php. I added $description and $twofactor to the function argument with default values and added descr and twofactor elements in the array passed to the dbInsert function call. OpenSuSE 13.2

This commit is contained in:
mchasteen
2015-02-13 11:30:10 -07:00
committed by laf
parent 98aba4307f
commit a1ef2e0f69
2 changed files with 5 additions and 4 deletions

View File

@@ -100,13 +100,13 @@ function auth_usermanagement()
return 1;
}
function adduser($username, $password, $level, $email = "", $realname = "", $can_modify_passwd='1')
function adduser($username, $password, $level, $email = "", $realname = "", $can_modify_passwd=1, $description ="", $twofactor=0)
{
if (!user_exists($username))
{
$hasher = new PasswordHash(8, FALSE);
$encrypted = $hasher->HashPassword($password);
return dbInsert(array('username' => $username, 'password' => $encrypted, 'level' => $level, 'email' => $email, 'realname' => $realname, 'can_modify_passwd' => $can_modify_passwd), 'users');
return dbInsert(array('username' => $username, 'password' => $encrypted, 'level' => $level, 'email' => $email, 'realname' => $realname, 'can_modify_passwd' => $can_modify_passwd, 'descr' => $description, 'twofactor' => $twofactor), 'users');
} else {
return FALSE;
}
@@ -114,7 +114,8 @@ function adduser($username, $password, $level, $email = "", $realname = "", $can
function user_exists($username)
{
return @dbFetchCell("SELECT COUNT(*) FROM users WHERE username = ?", array($username));
$return = @dbFetchCell("SELECT COUNT(*) FROM users WHERE username = ?", array($username));
return $return;
}
function get_userlevel($username)