FrontendUserAuthentication::loginField()
\nn\t3::FrontendUserAuthentication()->loginField($value = NULL, $fieldName = 'uid');
Login of an FE user using any field. No password required.
\nn\t3::FrontendUserAuthentication()->loginField( $value, $fieldName );
Copied!
| @return array
Source Code
public function loginField( $value = null, $fieldName = 'uid')
{
if (!$value) return [];
$user = \nn\t3::Db()->findByValues( 'fe_users', [$fieldName => $value] );
if (!$user) return [];
if (!count($user) > 1) return [];
$user = array_pop($user);
$request = \nn\t3::Environment()->getRequest();
$info = $this->getAuthInfoArray($request);
$info['db_user']['username_column'] = 'username';
$feUser = $this->setSession( $user );
return $feUser;
}
Copied!