vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Miscellaneous Hacks - Login via Email (https://vborg.vbsupport.ru/showthread.php?t=151921)

Till 07-09-2007 10:00 PM

Login via Email
 
Ok, basically I wanted to allow users to login via email. This is cheap and straight to the point, so feel free to add to this.

Unfortunately I could not find a hook to use for this, so I hacked my login.html.

PHP Code:

if ($_POST['do'] == 'login')
{
    
$vbulletin->input->clean_array_gpc('p', array(
        
'vb_login_username' => TYPE_STR,
        
'vb_login_password' => TYPE_STR,
        
'vb_login_md5password' => TYPE_STR,
        
'vb_login_md5password_utf' => TYPE_STR,
        
'postvars' => TYPE_STR,
        
'cookieuser' => TYPE_BOOL,
        
'logintype' => TYPE_STR,
        
'cssprefs' => TYPE_STR,
    ));
    
    if (isset(
$_POST['vb_login_username'])) {
        
$status eregi(
                
"^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,5})$",
                
$vbulletin->GPC['vb_login_username']
        );
        if (
$status !== FALSE) { 
            
$query "SELECT username FROM vb3_user WHERE email = '%s'";
            
$query sprintf($query$vbulletin->GPC['vb_login_username']);

            
$_resp $db->query_read($query);
            
$_user $db->fetch_row($_resp);
            
$_user = (string) @$_user[0];
            
            if (empty(
$_user) === FALSE) {
                
$_POST['vb_login_username'] = $_user;
            }
            
//var_dump($_user, $vbulletin->GPC['vb_login_username']);
            //exit;
        
}
    }

     
// can the user login?
     // to be continued. 


Hope this helps someone.

radarhunter 07-10-2007 10:31 PM

but atleast you could tell how to apply this mod ???

Hornstar 07-11-2007 03:31 AM

Is this finished? how exactly can a user login through their email?

succo 07-11-2007 05:23 AM

as far as i can see, this allows a user to login (in the forum website, of course) using the couple email_address/password instead of username/password

you need to edit login.php to make it work, changing the part starting with
Code:

if ($_POST['do'] == 'login')

Till 07-11-2007 05:33 PM

Quote:

Originally Posted by succo (Post 1288138)
as far as i can see, this allows a user to login (in the forum website, of course) using the couple email_address/password instead of username/password

you need to edit login.php to make it work, changing the part starting with
Code:

if ($_POST['do'] == 'login')

Thanks for the heads up, succo!

I edited the original post to make "login.html" bold.

So please, if anyone is interested, just read what I wrote. ;-)

Questions, comments, feedback? I am all ears.

COBRAws 07-11-2007 07:42 PM

no explanation at all

ianskate 10-10-2007 05:44 PM

nice... im afraid to try this on my active forum but i might install another vb forum soon and will try it out on that.

i also have a related thread here asking the same topic but without hacking the source:
https://vborg.vbsupport.ru/showthrea...22#post1357022

ianskate 01-25-2008 02:00 PM

for the record, this works very nicely.

to those whom say there is no explanation - u need to open the login.php file in ur forum folder on ur server, and just insert the code above where Till stated. its just a simple copy and paste, the only thing you need to edit is your user table name.

if you cant for some reason find that spot in your code, just do a search (ctrl + F) in the file for the line

Code:

if ($_POST['do'] == 'login')
and paste appropriately. :up:

Ghanem 10-31-2008 02:20 PM

Thank you, its working fine with 3.7.3 too :)


All times are GMT. The time now is 07:42 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01496 seconds
  • Memory Usage 1,744KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete