Author Topic: [Mod] Lost password for not activated users  (Read 21541 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Lost password for not activated users
« on: January 09, 2003, 12:27:21 AM »
was wondering if someone can do this:
send activation link along with new password if the user has not activated.
right now I'm not aware the way I as an admin, or a user can reseive email with activation link again if first email was lost...
right now email with registration for new user content username and password, and if a user go to "lost password" he'll receive email with new password, but since he is not activated it wont work.
so, it would be nice for not activated users receive new password AND again activation link.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
[Mod] Lost password for not activated users
« Reply #1 on: January 09, 2003, 07:06:14 AM »
HI V@no,

I think I have figured out how to do this, right now I think I must have been crazy I started at this as I really don't need it, but still I thought I was able to do so, so here is what I did:

Open member.php

Find:
Code: [Select]
if ($user_email != "") {
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password")."


Add:
Code: [Select]
get_user_table_field(", ", "user_activationkey").

So it looks like:
Code: [Select]
if ($user_email != "") {
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_activationkey")."





Find:
Code: [Select]
// Start Emailer
      include(ROOT_PATH.'includes/email.php');
      $site_email = new Email();
      $site_email->set_to($user_email);
      $site_email->set_subject($lang['send_password_emailsubject']);


After that you will find an array that looks like this:
Code: [Select]
$site_email->register_vars(array(
        "user_name" => $checkuser[$user_table_fields['user_name']],
        "user_password" => stripslashes($user_password),
        "site_name" => $config['site_name']
      ));


Now add:
Code: [Select]
"activation_url" => $script_url."/register.php?action=activate&activationkey=".$checkuser[$user_table_fields['user_activationkey']],

So the end result looks like this:
Code: [Select]
// Start Emailer
      include(ROOT_PATH.'includes/email.php');
      $site_email = new Email();
      $site_email->set_to($user_email);
      $site_email->set_subject($lang['send_password_emailsubject']);
      $site_email->register_vars(array(
      "activation_url" => $script_url."/register.php?action=activate&activationkey=".$checkuser[$user_table_fields['user_activationkey']],
        "user_name" => $checkuser[$user_table_fields['user_name']],
        "user_password" => stripslashes($user_password),
        "site_name" => $config['site_name']
      ));
      $site_email->set_body("lost_password", $config['language_dir']);
      $site_email->send_email();


Now you can use the tag: {activation_url} in your email templates.
Edit the Lost_password template in the Lang/{language}/email folder and add the {activation_url} tag somewhere.

Now upload all and I hope it works, I did tested it myself and for me it worked, but like I said before, I did not need it as my member don't have to activate.

Cheers,
Vraxor

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
[Mod] Lost password for not activated users
« Reply #2 on: January 09, 2003, 07:15:21 AM »
hmm, I'm sorry, but I just discovered that this contains a little big bug.

When you use this code the user password will no longer be correct in the mail so it won't really be a lost password mail anymore. I currently ain't have time to figure this out, but maybe this is the start you needed, or maybe there are others out there in the wild world who would like to take a close look at the code and see why it no longer send the password but a strange random code instead.

Cheers,
Vraxor

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
[Mod] Lost password for not activated users
« Reply #3 on: January 09, 2003, 10:55:23 AM »
Ok, something went wrong with the script and I have no idea what.

I'm such a beginner yet and while I thought I was able to write this little mod I begin to doubt about it now.
Somehow this script changes the password of the user you test it with, so the password becomes a strange random number, in no way this could be meant to happen, but the result was that my admin profile no longer reacted at my password.

I really hope someone could explain to me what went wrong, maybe Jan would like to take a look as I think that the code should be nearly good, just a small error somewhere is causing it to change the password, so anybody wanna help here?

Cheers,
Vraxor

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Lost password for not activated users
« Reply #4 on: January 09, 2003, 11:25:30 AM »
wow! Vraxor, it works great! thx alot!
I dont know what are u talking about some bug? no, no way! ;)
actualy it supposed to change password, because of security reason it create new, random password.

yesterday I spent 3 hours trying figure this out, I did same thing what u did, exept I didnt know that I must use "$checkuser[..]" - that why it didnt work for me.
but, here is a little moddification, that will only send activation URL if user has not activated yet, otherwise it will send only username and new password:

in your code add one more "get_user_table_field(", ", "user_level")" so it would looks like this:
Code: [Select]
   $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_password").get_user_table_field(", ", "user_activationkey").get_user_table_field(", ", "user_level")."
now, change
Code: [Select]
       "activation_url" => $script_url."/register.php?action=activate&activationkey=".$checkuser[$user_table_fields['user_activationkey']],to this:
Code: [Select]
       "activation_url" => (($checkuser[$user_table_fields['user_level']] == 1) ? "You have not activated your accout yet.
           Please click on this link before you can login with your User name and NEW password ".
               $script_url."/register.php?action=activate&activationkey=".$checkuser[$user_table_fields['user_activationkey']] : ""),

thx again, Vraxor! :D


P.S. duxby, now u can get your activation URL again ;) :D
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
[Mod] Lost password for not activated users
« Reply #5 on: January 09, 2003, 11:34:55 AM »
Hmm, ok, so I did not mess up my admin account  :? 8O  :D

Well I did not know that it was surposed to change the password, in that case it works correct. I just did not expected that so when I was unable to login with my admin account anymore I immidiatly started changing the database by hand. So I did not really try to login with the new password that was send to me.

Well, this means good news, and no bug  :lol:

Cheers,
Vraxor

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Mod] Lost password for not activated users
« Reply #6 on: March 14, 2003, 05:20:32 PM »
I need this too and found it by searching the forums. Maybe this thread can be moved to the published mods forum since it's a complete and working mod.  

Thanks guys.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
[Mod] Lost password for not activated users
« Reply #7 on: March 14, 2003, 05:41:05 PM »
Done
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [Mod] Lost password for not activated users
« Reply #8 on: August 15, 2005, 12:01:25 AM »
Great MOD, this must be in default 4images script

Offline live@ct

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
Re: [Mod] Lost password for not activated users
« Reply #9 on: August 17, 2005, 06:33:06 PM »
the second its the complete mod?!?! or I need to add the vano code?!
Existen 10 tipos de personas, los que entienden el codigo binario y los que no.

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [Mod] Lost password for not activated users
« Reply #10 on: August 17, 2005, 07:30:19 PM »
the second its the complete mod?!?! or I need to add the vano code?!
need to add at this time :(

 

Post your comments here