Jump to content

modifying ProcessforgotPassword to ignore session?


nghi
 Share

Recommended Posts

Currently, I'm trying to send automatic email with a forgot password link after a user is created. so that user can create their own password within 24 hours

But I keep getting the error telling me the session isn't the same.

What i got so far...

public function addUser($event){
    $u = new User();  
    $u->name = $new_user_name; 
    $u->email = $email; 
    $u->addRole("guest"); 
    $u->addRole("client"); 
    $u->save();

    $pfp = wire("modules")->get("ProcessForgotPassword");

    $user = wire("users")->get("name=$new_user_name"); 
    $pfp->sendemail($user);
}

public function sendemail($user) {
    $this->step2_sendEmail($user);}            
 
 

The Module I'm looking at is ProcessforgotPassword and the function i think i should be looking at is step2_sendemail but I honestly do not know what to do at the moment. I tried commenting out the databinds but ya im drawing blanks.

https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessForgotPassword.module

Link to comment
Share on other sites

Figure it out, Not sure if it's ideal...

I commented out the session part of the following if statements but still keep the token to be check still. I also modified the time from an hour to a day.

public function ___execute() {

if($this->session->userResetStep >= 2 && $this->session->userResetID === (int) $this->input->get->user_id) {
                                return $this->step3_processEmailClick();
protected function step3_processEmailClick() {

if($result->num_rows && $id == $this->session->userResetID) {
if($row['token'] && ($row['token'] === $token) && $row['name'] === $this->session->userResetName) {
$query->bindValue(":ts", time()-3600, PDO::PARAM_INT); 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...