Wordpress REST API - send reset password link

空扰寡人 提交于 2019-12-11 06:09:55

问题


I want to create a request from my application. (iOS and Android - Coded with Xamarin).

Explaination:

The request should trigger the WordPress action=lostpassword. - The user receives an email to reset his password in browser.

OR

The user will be able to set a new password. WordPress send a link to email - where the user has to verify, that he changed the password. Is there any chance to do this with a request to the REST API.

Maybe any similar ideas?

I have already tried:

  1. Plugins where function was given in documentation but not worked for me
  2. Manualy called wp-login.php?action=lostpassword with body

{ "redirect_to": "", "user_login": "name@provider.de", "wp-submit": "Neues+Passwort" }


回答1:


I think this should help you.

Example shows return a lost password URL http://example.com/lostpassword/ for the wp_lostpassword_url() function:

add_filter( 'lostpassword_url', 'my_lost_password_page', 10, 2 );
function my_lost_password_page( $lostpassword_url, $redirect ) {
    return home_url( '/lostpassword/?redirect_to=' . $redirect );
}


来源:https://stackoverflow.com/questions/52035737/wordpress-rest-api-send-reset-password-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!