Marty Walker Posted August 8, 2013 Share Posted August 8, 2013 I know there's a few topics on 'forgot password' but I'm after something simple. In this case the site owner will setup users in the PW admin and there'll be a login form to allow them to get access to some of the site content. All I really need is a way for a user to punch in their username and to then be emailed their password - I'm not looking for a reset. Any ideas on how to do this? Thanks Marty Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2013 Share Posted August 8, 2013 Hey Marty, the password is encrypted, which is why this isn't really possible. I guess you could hook into user save and make a copy of the password in a plain text field that could then be emailed, but I am sure everyone would agree that this is not a good idea 1 Link to comment Share on other sites More sharing options...
Marty Walker Posted August 8, 2013 Author Share Posted August 8, 2013 Hey adrian, Right that doesn't sound like best practice at all. I found this from Antti: http://processwire.com/talk/topic/2145-module-send-user-credentials/?hl=%2Bpassword+%2Breset Being the PHP noob that I am I know there's a way to tie this to a form but I know not how -Marty Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2013 Share Posted August 8, 2013 Hey Marty, But doesn't that module send a new password - I don't think it can send the user an existing password. Not sure how it would help in your case, but maybe I am missing the point. I am sure what you want to do is quite easy to accomplish, I just think that it might be better to explain to the client why it's not a good idea. Not many sites allow password recovery these days. EDIT: A password reminder might be a reasonable solution though, rather than sending their actual password. That could easily be stored as a custom field in the user template and emailed out on request. Link to comment Share on other sites More sharing options...
Marty Walker Posted August 8, 2013 Author Share Posted August 8, 2013 That's right Antti's module does send a new password. And that solution is ok too. All I need is some way to communicate a password to the user - either their old password or a new one. If it can happen without getting the site administrator involved then great. -Marty Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2013 Share Posted August 8, 2013 Ah ok, that makes sense I presume you have seen this, but just in case: http://modules.processwire.com/modules/process-forgot-password/ Also, worth reading this: http://processwire.com/talk/topic/490-how-to-reset-your-password-how-to-enable-the-forgot-password-function/ Link to comment Share on other sites More sharing options...
Marty Walker Posted August 8, 2013 Author Share Posted August 8, 2013 Yes I have seen that. I probably wasn't clear that I'd like to do this from a front-end form. Link to comment Share on other sites More sharing options...
Marty Walker Posted August 8, 2013 Author Share Posted August 8, 2013 I think I have something sorted (thanks to Ryan of course): http://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?hl=%2Bpassword+%2Breset#entry15894 1 Link to comment Share on other sites More sharing options...
adrian Posted August 8, 2013 Share Posted August 8, 2013 I have used that script of Ryan's for front-end password resets on several sites now - works a treat! Sorry, if I'd have known that's what you were looking for I'd have pointed you straight to it Link to comment Share on other sites More sharing options...
Marty Walker Posted August 8, 2013 Author Share Posted August 8, 2013 That's ok. I wasn't clear in the first place. You can imagine the strife I get into at home 1 Link to comment Share on other sites More sharing options...
apeisa Posted August 8, 2013 Share Posted August 8, 2013 Hey adrian, Right that doesn't sound like best practice at all. I found this from Antti: http://processwire.com/talk/topic/2145-module-send-user-credentials/?hl=%2Bpassword+%2Breset Being the PHP noob that I am I know there's a way to tie this to a form but I know not how -Marty Usage is dead simple: <?php // any check where you see if user has posted form and you start processing the form if ($input->post) { $username = $sanitizer->username($input->post->username); $u = $users->get("name=$username"); // Of course you could get the user by email or any other information $u->of(false); $u->send_password = 1; // send_password = whatever you have named your new field $u->save(); } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now