Skip to content

npp_usr_send_passwd_reset_email

Jurek Muszyński edited this page Mar 28, 2024 · 4 revisions

int npp_usr_send_passwd_reset_email()

Description

Sends password reset link to the user.

npp_usr_xxx functions directly read the query string / payload data.

Request must contain the following parameters:

  • email

Returns

Returns OK or one of the error codes:

  • ERR_INVALID_REQUEST
  • ERR_EMAIL_FORMAT
  • ERR_INT_SERVER_ERROR

Example

void npp_app_main()
{
    // ...

    else if ( REQ("forgot") )
    {
        // show forgot password form with action="do_forgot"
        render_forgot();
    }
    else if ( REQ("do_forgot") && REQ_POST )
    {
        ret = npp_usr_send_passwd_reset_email();

        if ( ret == OK )
            RES_LOCATION("/forgot?msg=%d", MSG_REQUEST_SENT);
        else
            RES_LOCATION("/forgot?msg=%d", ret);
    }
}

Notes

Requires NPP_USERS compilation switch.

Clone this wiki locally