php - email as username to login joomla 3.4 -


i can't set email perform login in site. create plugin authentication override existing 1 change sql query select id , password:

$query = $db->getquery(true)     ->select('id, password')     ->from('#__users')     ->where('**email**=' . $db->quote($credentials['username'])); 

i tried modify login.xml below:

 <field name="username"         type="email"         class="validate-email"         filter="email"         label="com_users_login_email_label"         size="25"         required="true"         validate="email"         /> 

when try login get:

you can't access private section of site 

can me?

i solved, , want share solution: don't need modify joomla.php of authentication plugin.

you have modify controller user.php in /components/com_users/controllers below: $data['email'] = $input->$method->get('email', '', 'email'); $db = jfactory::getdbo(); $query = $db->getquery(true) ->select('username') ->from('#__users') ->where('email=' . $db->quote($data['email'])); $db->setquery($query); $utente = $db->loadresult(); $data['username'] = $utente;

in way select correct username using email passed in form.

now can modify form of login (/components/com_users/models/form/login.xml changing occurences of "username" "email" (see below): <field name="email" type="email" class="validate-email" filter="email" label="e-mail" size="25" required="true" validate="email" />

then u have modify jmessage in case of login failed in language files.

that's all!

(for post-login redirection, adding itemid in url backs work....)

in these way edited core files , don't like. there anyway make override of com_users?


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -