-
Notifications
You must be signed in to change notification settings - Fork 4
npp_usr_change_password
Jurek Muszyński edited this page Mar 28, 2024
·
4 revisions
Changes user password and sets their status to USER_STATUS_ACTIVE.
npp_usr_xxx functions directly read the query string / payload data.
Request must contain the following parameters:
- opasswd (old password)
- passwd (new password)
- rpasswd (new password again)
Returns OK or one of the error codes:
- ERR_INVALID_REQUEST
- ERR_OLD_PASSWORD
- ERR_PASSWORD_TOO_SHORT
- ERR_PASSWORD_DIFFERENT
- ERR_INT_SERVER_ERROR
void npp_app_main()
{
// ...
else if ( REQ("change_password") )
{
// show change password form with action="do_change_password"
render_change_password();
}
else if ( REQ("do_change_password") && REQ_POST )
{
ret = npp_usr_change_password();
if ( ret == OK )
RES_LOCATION("/dashboard");
else
RES_LOCATION("/change_password?msg=%d", ret);
}
}Requires NPP_USERS compilation switch.