Reset any password with a $_POST['email']

Public

Get raw version
php
  1. function my_function() {
  2. if(!empty($_POST['email'])) {
  3. $email = $_POST['email'];
  4. $user = user_load_by_mail($email);
  5. if($user) {
  6. _user_mail_notify('password_reset', $user);
  7. $new_message = 'Check your email for a reset link.';
  8. drupal_set_message($new_message);
  9. } else {
  10. $new_message = 'That email is not connected to an account.';
  11. }
  12. } else {
  13. $new_message = 'You must send an email account to reset.';
  14. }
  15. }

Comments