add forgot password functionality to example wordpress self-service, RT#75279
[freeside.git] / fs_selfservice / wordpress / forgot_password.php
1 <?php
2
3 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
4 get_header();
5
6 $freeside = new FreesideSelfService();
7
8 if ( isset($_POST['email']) ) {
9
10   $result = $freeside->reset_passwd(array(
11     'email' => $_POST['email'],
12   ));
13
14   if ( $result['error'] ) {
15     $_REQUEST['freeside_error'] = $result['error'];
16   } else {
17     $sent = 1;
18   }
19
20 }
21
22 ?>
23
24 <?php if ( $sent == 1 ) { ?>
25
26         A verification email has been sent to your mailbox.  Please follow the
27         link in your email to complete your password reset.
28
29 <?php } else { ?>
30
31 Please enter your email address.  A password reset email will be sent to that
32 address<BR><BR>
33
34 <?php include('elements/error.php'); ?>
35
36 <FORM METHOD="POST">
37 <INPUT TYPE="text" NAME="email" VALUE=""><BR>
38 <INPUT TYPE="submit" VALUE="Send reset email">
39 </FORM>
40
41 <?php } ?>
42
43 <?php get_footer(); ?>