PDA

View Full Version : [Release vb2.0] Send random password instead of activation code


bira
05-04-2001, 10:00 PM
THIS HACK WILL NOT WORK IN VB 2.2.0 AND UP! DO NOT ATTEMPT TO INSTALL IT!
Go to https://vborg.vbsupport.ru/showthread.php?s=&threadid=33068 for the appropriate hack


This is something I've wanted to do for a long time, and since someone mentioned it in the Suggestions forum, I figured I'd write the hack :)

Purpose: When a new user regsiters, he is e-mailed a password generated randomly. He will not be able to log in until he receives this e-mail and uses that password. (the same happens if an existing user changes his e-mail address).

After installing this hack, you will have three options essentially:

1) Don't verify the e-mail is valid.
In this case the user selects his own password and nothing is sent to him.

2) Verify the e-mail is valid by sending an activation code
This is how vBulletin works now: a user selects his own password during registration, and the BB Mailer sends him an activation code / link that he needs to use before he's able to post

3) Verify the e-mail is valid by sending a random password
In this case the user DOES NOT select a password but instead he receives a randomly generated password by e-mail. He will not be able to log in / post until he receives and uses this password.


The installation includes:

1) Running a script that updates your database (adds an option "Send New Users Random Password?" with default "NO" -- to preserve your currect state).

2) Editing three scripts (register.php, member.php, admin/functions.php)

3) Editing two templates (registeradult, registercoppa) and adding three new templates (small ones).


If you have questions, I'm here :)

Cheers,

Bira

bira
05-05-2001, 12:23 AM
A couple of images to help out understand what this hack does:

http://www.atlasf1.com/personal/bira/password1.gif

And

http://www.atlasf1.com/personal/bira/password2.gif

Essam
05-05-2001, 12:26 AM
Thats great, I will try it today.
one question, if the user change his email, will your hack send new password?

bira
05-05-2001, 12:28 AM
yes, Essam, if the user changes his e-mail, it will automatically generate his a new password, e-mail it to him and log him out so he won't be able to log in until he uses this new password.

bira
05-05-2001, 12:30 AM
If people want to test it, they can test this on my test board at

http://www.bira.co.il/bb/index.php

*** DISCLAIMER TO JELSOFT: this is NOT a production bb but rather a test board that I've set up for Ed Sullivan. Please don't sanction me for using it (no one posts on it or anything.)

nuno
05-05-2001, 12:34 AM
thank you bira
excellent ;)

bokhalifa
05-05-2001, 06:00 AM
good hack;)

floleb7
05-05-2001, 10:55 AM
it would be great to include this to 2.0 ;)

bokhalifa
05-05-2001, 11:26 AM
where can i change this sentence?


????????????????????
Here are your login details for the bulletin board at http:// .

Username = bokhalifa
Password = +

Don't forget that they are case sensitive!

To edit your profile, go to this page:
http://

Yours,
dar bokhalifa team

??????????????????????????????????

thanks;)

Essam
05-05-2001, 06:20 PM
question, what will happen to the ppl who havn't activated themsevles? of course I mean the ones who registered before installing this hack.

bira
05-05-2001, 06:35 PM
Essam, they can still activate themselves. That system did not get impaired in any way.

bokhalifa, this is the template email_lostpw -- it's the same template that people get when they lost their password and request for it.

Essam
05-05-2001, 06:48 PM
mmm,,
Is there a way to send all the unactivated members a new password? instead of still requiring them to activate themselves.

bira
05-05-2001, 06:54 PM
Essam, go to the Control Panel -> Usergroups. Click in 'list users' next to Users Awaiting Email Confirmation. For each user you can:

1) change his usergroup to 'registered'
2) click on 'send password'

If you have more than a dozen or so, let me know and I'll write you a quick script to run to do that in a batch.

bokhalifa
05-05-2001, 07:35 PM
thank you bira

good hack min;)

Essam
05-05-2001, 07:54 PM
More than a dozen?! :)
I have 1319 member awaitning confirmation

I would really appreciated if you write me that hack. The hack will send a random password right?
Cause for the normal password this can be done from "Email Users".

bira
05-05-2001, 08:12 PM
Essam with so many, I would actually recommend you delete them, because there are bound to be a lot of duplicate people who tried several times, or people who tried a long time ago and forgot about it.

If, however, you want to send them a password anyway and don't mind about "dead" registrations, then you could just do the following two steps IN THAT ORDER:

1) email password to all the users in the "Users Awaiting Email
Confirmation"

2) AFTER sending the e-mail, run a MySQL query via phpMyAdmin:


UPDATE user SET usergroupid='2' WHERE usergroupid='3' AND posts='0'


Personally, I would recommend you delete all those accounts who are, say, one month old. If you want to do this, then run the following command BEFORE you do steps 1 and 2 mentioned above:


DELETE FROM user WHERE usergroupid='3' AND posts='0' AND joindate<'986500000'

Essam
05-05-2001, 08:20 PM
Thank you bira,
I'll try that.

-dloh-hammer
05-08-2001, 07:37 PM
Is this hack for rc1 or rc2 ?

get a parsing error in register.php line 204 /207

bira
05-09-2001, 05:50 AM
rc2

-dloh-hammer
05-09-2001, 11:57 AM
lol than I must upgrade :)

Remi
05-09-2001, 12:17 PM
bira

Thank you very very much

It was a dream to have this hack :D

I have RC1 and it is working wounderfull

bira
05-09-2001, 12:30 PM
Glad to have helped, Remi :)

RobAC
05-09-2001, 09:51 PM
This is an awesome hack as I just tested it out on my forums, but it breaks Tubedogg's automatic welcome message upon registration hack. :(

bira
05-09-2001, 10:30 PM
RobAC, if you give me the URL to that hack, I'll check where they collide and how you can use them together.

RobAC
05-09-2001, 10:38 PM
Bira,

Here you go. Thanks!

http://www.vbulletin.com/forum/showthread.php?s=&threadid=13857

bira
05-09-2001, 10:49 PM
RobRAC,

I checked tubedogg's hack and there's no reason the two hacks should collide, provided you insert the code right.

Here's what you need to make sure:

If you already hacked the file register.php then the end result should be like this.

Find (in the ORIGINAL file):


if ($verifyemail) {
$getjoindate=$DB_site->query_first("SELECT joindate FROM user WHERE userid='$userid'");
$activateid=$getjoindate[joindate];

eval("\$message = \"".gettemplate("email_activateaccount",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_activateaccount",1,0)."\";");

mail ($email,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");

}


And CHANGE that to (my hack's addition is in red, and tubedogg's hack addition is in blue):


if ($verifyemail) {
if ($randpassword=="0") {
$getjoindate=$DB_site->query_first("SELECT joindate FROM user WHERE userid='$userid'");
$activateid=$getjoindate[joindate];

eval("\$message = \"".gettemplate("email_activateaccount",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_activateaccount",1,0)."\";");
} else {
eval("\$message = \"".gettemplate("email_lostpw",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_lostpw",1,0)."\";");
}

mail ($email,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");

}

// send a welcome email using email_welcome and emailsubject_welcome templates, but don't
// send it now if they need to activate their account
if ($welcomeuser) {
eval("\$message = \"".gettemplate("email_welcome",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_welcome",1,0)."\";");

mail($newuseremail,$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");
}
// end send mail


That's it. The two hacks don't even "meet" at any other point :)


By the way, out of curiosity: if you are using email verification, be it with activation code or with random password, why on earth do you need a separate Welcome E-mail? Simply add your welcome message and whatever text you want to the already existing e-mail templates that are sent to the new users.

RobAC
05-09-2001, 10:56 PM
Bira,

I'll double check this....actually, you've made a good point here. Thanks.

RobAC
05-09-2001, 11:18 PM
Bira,

Instead of using the email_lostpw template, how can I use a different email template? I want to add in the welcome message to this template, but don't want to make that kind of addition to the lostpw template.

bira
05-09-2001, 11:25 PM
Rob, create a new template (eg: email_newpw) and in my hack, wherever it mentions email_lostpw change it to your new template's name.

p.s.

But make sure that the variables from email_lostpw (the variables for the username and password at least!) also appear in your new template.

bira
05-09-2001, 11:35 PM
Actually, Rob, there is only one place you need to replace email_lostpw with your new template's name, and that is in register.php.

In my hack instructions it says:


Find:

$getjoindate=$DB_site->query_first("SELECT joindate FROM user WHERE userid='$userid'");
$activateid=$getjoindate[joindate];

eval("\$message = \"".gettemplate("email_activateaccount",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_activateaccount",1,0)."\";");

REPLACE it with:

if ($randpassword=="0") {
$getjoindate=$DB_site->query_first("SELECT joindate FROM user WHERE userid='$userid'");
$activateid=$getjoindate[joindate];

eval("\$message = \"".gettemplate("email_activateaccount",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_activateaccount",1,0)."\";");
} else {
eval("\$message = \"".gettemplate("email_lostpw",1,0)."\";");
eval("\$subject = \"".gettemplate("emailsubject_lostpw",1,0)."\";");
}


This refers to register.php. So, in that bit - and ONLY that bit - you will want to replace email_lostpw with your new template's name, as well as emailsubject_lostpw with a new template's name (for the subject message of your combined Welcome + Password to new user).

So, to sum this up:

1) Create two new template, say email_newpw and emailsubject_newpw. These two templates should resemble in content the lostpw templates, only with your Welcome text.

2) Add my hack EXACTLY like the instructions says, but before you upload the hacked files run a SEARCH/REPLACE in register.php for _lostpw and replace it with _newpw.

That's it.

Am I making any sense? Sorry, I'm tired :)

RobAC
05-10-2001, 02:23 AM
Another problem, for some reason, I'm no longer notified when a new user registeres with the Forums. I have it set so that I'm notified as soon as someone registers. I no longer receive this email notification.

bira
05-10-2001, 02:26 AM
Rob, for some reason I get a feeling that you managed to much up register.php :)

I use this hack and get notified for every new user, so that's not the problem.

Why don;t you e-mail me your register.php and I'll fix it?

My e-mail is goren@atlasf1.com

Cheers,

Bira

psico
06-21-2001, 10:24 AM
Bira I have a problem!!
I'm using vb 2.0.1 and when the users wants to change something from their CP the changes are not taken and the member.php put this message:


Thank you for updating your profile, psico. Because you changed your email address, you will be sent an email to verify its existence.


But I've not changed my email...

Sorry about my english but It's not my language...

Thanks for your help...

J_PC
06-21-2001, 12:19 PM
Thanks for a cool hack

MApI
06-23-2001, 08:18 PM
Bira,
I'm using vb 2.0.1, followed hack instructions (isn't the firt one I insert), but nothing happen.
There isn't into CP something to change sets, and new users can choose their password.

Thanx in adv.

:confused:

MApI
06-26-2001, 05:38 AM
Might be the template side ? The new one comes in the istructions without any HTML command. It that regular ? Yek !

cya

:confused:

psico
06-27-2001, 12:56 AM
Please anyone can help me with my problem?

Thanks a lot!!!.


I'm using vb 2.0.1 and when the users wants to change something from their CP the changes are not taken and the member.php put this message:


Thank you for updating your profile, psico. Because you changed your email address, you will be sent an email to verify its existence.

But I've not changed my email...

bira
06-27-2001, 12:59 AM
I've installed a clean (no hacks) version of vBulletin 2.01 and then installed this hack as per the instructions, followed to a T.

I had no problems at all, and none like you describe. I really, really don't have a clue what the problem could be for you, but I would suggest you go back to the original version(s) of the scripts, and then re-install the hack, making sure you follow the directions exactly.

Sorry I cannot be of any further help.

Buu
06-28-2001, 11:28 PM
Bira i installed your hack today now everything seems to be fine but when i let some one register it gives an code fatal error on Line 192 in the register.php file.......

NE idea's to help you as much as i can i include the full Register.php.

You can contact me by mail or icq

-= ICQ 100535249
-= Mail : shadowbumble@hotmail.com

Hope this will be enough

Removed on request

bira
06-30-2001, 04:32 AM
Buu,

1) Your register.php page is NOT a vB2 version one

2) vBulletin does not allow the posting of an entire script. Please remove the attachment from your post.

Cheers,

Bira

Remi
07-01-2001, 01:15 PM
Bira

Is there a way to send all the users a new password

The reason for this is to prevent any user with false Email from posting.

Thanks in advance Bira

bira
07-01-2001, 08:27 PM
Remi,

You mean you want to mass-change the password to all the registered users, and mass-email all these users their new password?

Please elaborate as much as you can, and I'll write you a script on how you can do this.

Remi
07-01-2001, 11:18 PM
Yes Bira

This is exactly what I mean :o

I am very thankful to you Bira :o

psico
11-03-2001, 11:22 PM
I REALLY need this Hack for vB2.2.0 but the code is diferent in the register.php anyone knows how to make it works?

THANKS!!

Remi
12-09-2001, 01:50 AM
Does this hack work with the latest version 2.2.1?

Thanks

bira
12-09-2001, 01:57 AM
<font color="red">THIS HACK WILL NOT WORK IN VB 2.2.0 AND UP! DO NOT ATTEMPT TO INSTALL IT!</font>

Remi
12-09-2001, 03:31 AM
:(

IS there any hope of upgrading the hack Bira!!

It was a very usefull

bira
12-09-2001, 03:33 AM
Remi I'll look at it, but I can't promise.

The whole password & activation processes have changed completely in 2.2.0 and up, so I'll have to look at the code and see what I can do for you.

Remi
12-09-2001, 03:45 AM
Thank you very much Bira

Please do your best, it is extreamly important for me and I am sure it is as important for many othrers

bira
12-09-2001, 08:51 AM
<a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=33068" target="_blank">https://vborg.vbsupport.ru/showt...threadid=33068</a> -- version 2 of this hack, for vBulletin 2.2.0 and up.