News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF 2.0.8 Login with e-mail, not username

Started by zmc, August 26, 2014, 06:22:32 AM

Previous topic - Next topic

zmc

Sorry, I speak a little english.

I would like use login page email address and password combination, not username and password combination for auth. How to?


<?php

require_once(
"forum/SSI.php");
if ($context['user']['is_logged']) {
header ( 'location: http://localhost/forum' ); // logged
} else {
if ( isset ( $_POST [ 'login' ] ) ) {
if ( /* check the $_POST [ 'email' ] and $_POST [ 'pw' ] */ ) {
// login
header ( 'location: http://localhost/forum' );
} else {
print 'error email or/and password fields';
}
}
print '<form method="post" name="login">
      <input type="text" name="email">
      <input type="password" name="pw">
      <input type="submit" name="login">
      </form>'
;
}

?>


My forum is protected/private and I use it is the Settings.php file:


<?php

$ssi_guest_access = true;

Arantor

This is why you're supposed to be using SMF's own login form because SMF will already accept either quite happily, and this is why you use ssi_login() to do it.
Holder of controversial views, all of which my own.


Advertisement: