
The password is encrypted using the crypt function with the username as salt for the function. If this doesn't make any sense, try checking out the crypt documentation. I wanted an add-on application to use the logons from OTRS to avoid creating yet more accounts... here is an excerpt of the PHP code that might help as you can see how to use the crypt function (at least in PHP): session_start(); require_once("config.php"); include_once("header.php"); if (!isset($_SESSION['userauth'])) { /* The user is not logged in yet */ $_SESSION['username'] = $HTTP_POST_VARS['username']; $_SESSION['password'] = $HTTP_POST_VARS['password']; $pwhash=crypt($password, $username); /* Connecting to and selecting database */ $dbhost = $_SESSION['dbhost']; $dbuser = $_SESSION['dbuser']; $dbpass = $_SESSION['dbpass']; $link = mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect : " . mysql_error()); mysql_select_db($_SESSION['otrsdbname']) or die("Could not select database"); $query = "select first_name, last_name, id from system_user where login='$username' and pw='$pwhash' and valid_id=1"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $userrec = mysql_fetch_row($result); $rowcount = mysql_num_rows($result); if ($rowcount > 0) { $_SESSION['userrec'] = $userrec; $_SESSION['userauth'] = TRUE; } else { $loginscreen = $_SESSION['rturl']; print "<p><center><strong>Invalid username/password, please click <a href=$loginscreen/index.php>here</a> to try again</p>"; } } -----Original Message----- From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Tom Hesp Sent: Wednesday, January 07, 2004 9:06 AM To: User questions and discussions about OTRS. Subject: RE: [otrs] Cannot login as root@localhost Hi Norbert, First of all I am not sure whether the way you are storing the password in the database is correct. You need to check the OTRS code (Kernel/System/User.pm) on how the system stores passwords (encrypted!) Secondly check whether the user is still valid (valid_id == 1 in table system_user). If this does not solve the problem you may need to assign an existing user to the a group that is allowed to add users (tables groups and group_user) Good luck, Tom -----Original Message----- From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org]On Behalf Of norbert@munkel.net Sent: woensdag 7 januari 2004 14:47 To: otrs@otrs.org Subject: [otrs] Cannot login as root@localhost Hi, I was a bit lazy when I set up a otrs for some colleages. Worked fine for a while but now I need some new user accounts. Unfortunally, I forgot the password of root@localhost.;-) What I did, is changing the password in the database: update system_user set pw=password('foobar') where id=1; The database has been flushed, reloaded, restarted several times since the change but I still can't login as root@localhost. I tried rcotrs restart-force as well. No effect. Any hint? Thanks! cu, Norbert _______________________________________________ OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs Support oder Consulting für Ihr OTRS System? => http://www.otrs.de/ _______________________________________________ OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs Support oder Consulting für Ihr OTRS System? => http://www.otrs.de/