mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user