benbyf

deleting current user

2 posts in this topic

within my module not sure how to delete the current user and redirect without incurring this error:

Fatal error: Exception: You do not have permission to execute this module - ProcessPageView (in /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Modules.php line 1022) #0 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Modules.php(940): Modules->getModule('ProcessPageView') #1 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Session.php(609): Modules->get('ProcessPageView') #2 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Wire.php(398): Session->___redirect('/') #3 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/Wire.php(333): Wire->runHooks('redirect', Array) #4 /srv/users/serverpilot/apps/betaville-dev/public/site/modules/Subscribers/Subscribers.module(345): Wire->__call('redirect', Array) #5 /srv/users/serverpilot/apps/betaville-dev/public/site/templates/login.php(27): Subscribers->deleteUser('benjaminbyford5...') #6 /srv/users/serverpilot/apps/betaville-dev/public/wire/core/TemplateFile.php(182): require('/srv/users/serv...') #7 /srv/users/serverpilot/apps/betavi in /srv/users/serverpilot/apps/betaville-dev/public/index.php on line 248

 

$u = $this->user;

// user found and deleted
$this->users->delete($u);

// send to homepage
$homepage = $this->pages->get('/');
$this->session->redirect($homepage->url);

 

Share this post


Link to post
Share on other sites

Not sure, but maybe try hooking after: Session::redirect

Or maybe you need to: $session->logout() first.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By benbyf
      Hi,
      I posted a question on Stack and as yet not got an anwser that is something novel. I'm interested to know if this worries anyone else and whether we can do something about it.
      So here goes:
      If a user logins to your online sevice, let's say a job posting site, they give you an email and password to access your service later... Lets say a malicous person with access to the server could write into the template to store the passwords as plain text somewhere. Given that people generally don't use a new password for each website, now that malicious person has the potential to access other online services using these details (where there isn't any secondly security like 2-factor).
      Is there anything we can do to battle this? In an ideal world, maybe setting up a zero-knowledge algorithm to log people in and out...
      https://security.stackexchange.com/questions/155806/what-to-do-about-compremised-passwords-through-malicious-sites-or-site-hacks/155823#155823
       
      food for thought
    • By Cengiz Deniz
      Guests can not see page content. But users can.
       
      Guest window:

       
      User /Admin Window
       

       
      And this is my template file:
      <h3> <?php echo "$page->title Konusunda özlüsözler"; ?> </h3> <?php $kisiler= $pages->find("template=kisi,sort=title,repeater_ozlusoz=[ozlusoz_konusu=$page->id]"); $n=1; foreach ($kisiler as $kisi) { foreach($kisi->repeater_ozlusoz as $aforism) { $tags = ''; foreach ($aforism->ozlusoz_konusu as $tag) { $tags .= '<a href="'.$tag->url.'">'.$tag->title.'</a>&nbsp; &nbsp;'; } if ($tag->id == $page->id) { echo '<p>'.$n.'. <a href="'. $kisi->url .'">'.$kisi->title.'</a> : "<i>'. $aforism->ozlusoz.'</i>"<br/>&nbsp; &nbsp; Etiketler: '.$tags.' </p>'; $n=$n+1; } } }  
      I  checked Template and Field Permisions.  Cache disabled.
      Thank you for your help
       
       
       
    • By ragnarokkr
      Hi all!
      My first post here, and I'm pretty new to the PW thing, even if I'm falling in love with it  .
      Currently, I'm making a portal with PW and trying to add a few custom fields to the users' profile (image, socials, etc.).
      The issue here is that I'm able to add custom fields to the user profile, but PW doesn't save the values into these fields. It does let me insert the text or upload the image, but doesn't stores them into the database. And no error is printed out.
      By looking into the network traffic I did find that in some case it returns a JSON response:
      {"error":false,"message":"AJAX Page not saved (no changes)"} I've searched/googled about this particular issue but didn't find anything about it. I also have tried the solution described in this other topic (https://processwire.com/talk/topic/1002-cant-upload-imagefiles-problem/) to try in solving the image issue at least, without any good result.
      I thought the problem was maybe connected to the file permissions on the local installation, but the same situation has verified on remote test installation.
      I'm using latest stable PW version on WAMP:
      Apache v2.4.9 PHP v5.5.12 MySQL v5.6.17 Any idea, friends? Thanks.
    • By cybromancy
      Hi there, going a bit crazy here. Trying to be a user and change the role of another user.
      //get the user id to change $changeRole = $users->get($sanitizer->username('username'))->id; //add role $changeRole->addRole('moderator'); //save changes $users->save($changeRole);  
      What am I missing? Is it a user permissions setting? All I saw were permission settings for pages.
      Thanks up front for the help.
    • By Doc
      Hello,
      Newbie question here.
      I'm rebuilding my existing website with PW, it's a game where people can guess the winners of races.
      I used to have a "players" table. Those are registered players, I used to identify them through their login/password, and when it matches, I give them access to the website. No rocket science.
      So now with PW, I'm building my sign-up form and I'm trying to create a new session when a new user sign up.
      I'm retrieving user/pass from the sign-up form which has been posted before but :
      if($session->login($user, $pass)) {
          // login successful
          $session->redirect(elsewhere);
      }
      else
          echo "failed";
      ... fails everytime.
      Do I have to use something like :
      $u = new User(); $u->name = "bill"; $u->pass = "billpwd"; $u->addRole("guest"); $u->save(); ... before doing a session->login('bill', 'billpwd') ?? (I've just checked, it works, so I guess this is the good way to do it ?)
      I already have my players table so perhaps I can have the minimum in the PW's table and keep my players info in my historical table ?
      ... Or I can add all information I need into PW but I'd like to understand where it is stored.
      Last question, if there is a PW matching between "user" and "session", I need to give to the session->login function the password not hashed. I'm using the password_hash php function, any problem with that ?
      Thanks