Opened 6 years ago

Closed 5 years ago

#1484325 closed Bugs (fixed)

virtuse login creates new users every logon

Reported by: crook Owned by:
Priority: 5 Milestone:
Component: PHP backend Version: 0.1-beta2
Severity: normal Keywords:
Cc:

Description

Using the virtuser_file option roundcube detects the right username successfully.
The problem is that roundcube creates every login a complete new user in the database when loggin on with an email. (So the user's preferences can't be used)

Loggin on with the username works properly and the system uses the existing user.

Change History (3)

comment:1 Changed 6 years ago by Claude Schmidhuber

  • Component changed from Database to PHP backend
  • Version changed from 0.1-beta to 0.1-beta2

I just encountered the same problem.
However the solution is easy.

Just move the rcmail_email2user above the user-existing-query

------------------------------------------------------------------------------------
file: \program\include\main.inc
------------------------------------------------------------------------------------
about at line 470
------------------------------------------------------------------------------------
	/* [cls] virtuser-resolving only makes sense if done before checking if 
		the user already exists in roundcube db */
  // try to resolve email address from virtuser table    
  if (!empty($CONFIG['virtuser_file']) && strstr($user, '@'))
    $user = rcmail_email2user($user);


  // query if user already registered
  $sql_result = $DB->query("SELECT user_id, username, language, preferences
                            FROM ".get_table_name('users')."
                            WHERE  mail_host=? AND (username=? OR alias=?)",
                            $host,
                            $user,
                            $user);

  // user already registered -> overwrite username
  if ($sql_arr = $DB->fetch_assoc($sql_result))
    {
    $user_id = $sql_arr['user_id'];
    $user = $sql_arr['username'];
    }

		/* [cls] moved virtuser_file check prior to db query, to line 474*/
-----------------------------------------------------------------------------

regards,
claude

comment:2 Changed 6 years ago by aphexer

I can confirm this bug still exists in 0.1-rc1. I applied the patch above and it fixed it. Thanks for the patch.

But please, when will this finally be fixed in subversion? I hope it's in rc2.

comment:3 Changed 5 years ago by thomasb

  • Resolution set to fixed
  • Status changed from new to closed

Should be fixed in current trunk. Please reopen if the problem persists.

Note: See TracTickets for help on using tickets.