Login from VB Forum show a blank page in Drupal

RAFA3L - February 23, 2009 - 03:09
Project:Drupal vB
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I delete the javascript code in the navbar vb form

onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)"

And change the path on the action to:

action="../drupal/drupalvb/login" method="post" accept-charset="UTF-8"

When I press the submit buttom a get a blank page, I'm missing something?

Thanks in advance

#1

thehong - February 24, 2009 - 08:25

I have same pb.

Look at drupalvb_login() function here, look like the author did not update the document:

We need also change the username field's name to "name", and password field to "pass".

Andy

#2

thehong - February 24, 2009 - 08:30
Category:support request» bug report

I get this error after submit (modified) VB login form:

Fatal error: Call to undefined function drupalvb_auth() in /home/giavang/public_html/home/sites/all/modules/drupalvb/drupalvb.module on line 479

Andy

#3

sun - February 24, 2009 - 11:10
Status:active» fixed

Instead of looking at the code, you could have looked at the latest changes:

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/drupalvb/CH...

This file is also linked from the project page as "Read complete log of changes".

To fix the fatal error, update to the latest development snapshot.

#4

RAFA3L - February 24, 2009 - 14:55

Thanks!

I notice that the version 6.x.2.x-dev need a little change, the function user_login_validate() now don't exist in Drupal 6, this must be user_authenticate(). Line 491 in drupalvb.module

And need to add a hiden field "destination" to redirect the login from vb. This is in navbar style.

Now I'm trying to show the error message when the login fail, form_get_errors() always return empty.

#5

sun - February 24, 2009 - 23:07
Status:fixed» active

Patch?

#6

RAFA3L - February 25, 2009 - 01:23

Sorry, but I'm not familiarized creating patches, I'm trying create it with diff but for now don't look like the anothers I saw here.

The change is in line 492 on drupalvb.module:

user_login_validate($_REQUEST['form_id'], $_REQUEST);

to

user_authenticate($_REQUEST);

Now, I would like redirect to the drupal login page when the login fails and show the error message. Actually I can redirect to the index forum if the login is ok.

#7

CrashTest_ - March 29, 2009 - 07:51
Status:active» needs review

Ok, I have gotten this to work, changing the VB login form in template navbar to look like this:

<!-- login form -->
<form action="/drupalvb/login?destination=/services/Board" method="post" name="user-login-form" onsubmit="user_login_submit" id="user-login-form">
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td class="smallfont"><label for="navbar_username">$vbphrase[username]</label></td>
<td><input type="text" class="bginput" style="font-size: 11px" name="name" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td>
</tr>
<tr>
<td class="smallfont"><label for="navbar_password">$vbphrase[password]</label></td>
<td><input type="password" class="bginput" style="font-size: 11px" name="pass" id="navbar_password" size="10" tabindex="102" /></td>
<td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
</tr>
</table>
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
</form>
<!-- / login form -->

And changing the FORUMHOME template in VB to look like:

<!-- member logout -->
<td align="$stylevar[right]"><a href="/drupalvb/logout"><phrase 1="$bbuserinfo[username]">$vbphrase[log_out_x]</phrase></a></td>
<!-- end member logout -->

Then, I needed to figure out the changes to the Drupal authentication. This part probably needs some work, because I don't believe I am validating well enough, so some review of this patch would be good. Also, an entire function (drupalvb_auth) that is called by the drupalvb_user_login had been removed, so I put it back. If there was a reason for the removal, perhaps there could be a way to not call that function?

I am a themer by trade, so it is very likely that my code still needs work, so please take a look. It is all working on my implementation though, so maybe I am close!

AttachmentSize
drupal-vb-380658.patch 5.2 KB

#8

sun - March 29, 2009 - 21:56
Status:needs review» needs work

function drupalvb_user_login($account) {
+  global $user;
+  module_load_include('inc', 'drupalvb');
+  module_load_include('inc', 'user', 'pages');
   $vbuser = db_fetch_array(drupalvb_db_query_range("SELECT u.userid, ub.liftdate FROM {user} u LEFT JOIN {userban} ub ON ub.userid = u.userid WHERE u.username = '%s'", drupalvb_htmlspecialchars($account->name), 0, 1));

global $user is not required here.

-      }
-      else {
+     }
+     else {
...
-      }
-    }
-  }
-}
-
+       }
+     }
+   }
+ }

Please only change lines that need to be changed. Also, change your editor configuration to use spaces instead of tabs.

+/**
+ * Implementation of hook_auth().
+ */
+function drupalvb_auth($username, $password, $server = NULL) {

I have no idea why this function is added here.

#9

CrashTest_ - March 30, 2009 - 00:42
Status:needs work» needs review

Thanks for the review, and the pointers!

I have cleaned up the code and patched again. Looks a lot more straightforward now. Also, yes, for some reason I had not checked the "Use spaces" even though I had told my editor how many spaces I wanted to use instead of tabs ;)

I have left in the function drupalvb_auth() because it is called from function drupalvb_login(). As I mentioned before, I am not sure how to do it without that function. Any ideas there?

AttachmentSize
drupal-vb-380658-2.patch 4.39 KB

#10

sun - March 30, 2009 - 01:23
Version:6.x-2.x-dev» 6.x-2.0
Component:Miscellaneous» Code

I think what you want is simply this.

AttachmentSize
drupalvb-HEAD.drupalvb-login.patch 1.92 KB

#11

sun - July 29, 2009 - 18:29

Using $_POST instead of $_REQUEST. Can anyone confirm whether this patch works?

AttachmentSize
drupalvb-HEAD.drupalvb-login.patch 1.98 KB

#12

sun - August 2, 2009 - 01:22
Status:needs review» fixed

Thanks for reporting, reviewing, and testing! Committed to 6.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

#13

System Message - August 16, 2009 - 01:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.