contao/test — Issue #2155: ModuleLogin querying database directly instead of using API
Author: importer
Created: 2011-11-29 09:12:23+00:00
State: open
Labels: Defect, frontend, Invalid

Hi,

I'm currently working on a custom user backend integration and encountered an odd regarding use of existing APIs. Method ModuleLogin::generate() is querying tl_member for a record matching username after importing class FrontendUser. Code starting at line 108 is (as of 2.8.3):

```
$objGroup = $this->Database->prepare("SELECT groups FROM tl_member WHERE username=?")
->limit(1)
->execute($this->Input->post('username'));

if ($objGroup->numRows)
{
$arrGroups = deserialize($objGroup->groups);

if (is_array($arrGroups) && count($arrGroups) > 0)
{
```

Isn't better to have something like this:

```
$this->User->findBy('username',$this->Input->post('username'));
$arrGroups = $this->User->groups;
```

Regards.

--- _Originally created by soletan on June 17th, 2010, at 04:05pm (ID 2155)_