salix/db/changes/10221-accountModule/00-user_setPassword.sql

22 lines
569 B
SQL

DROP PROCEDURE IF EXISTS account.user_setPassword;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE account.user_setPassword(vSelf INT, vPassword VARCHAR(255))
BEGIN
/**
* Change the password of the passed as a parameter. Only administrators should
* have execute privileges on the procedure since it does not request the user's
* current password.
*
* @param vSelf The user id
* @param vPassword New password
*/
CALL user_checkPassword(vPassword);
UPDATE user SET
`password` = MD5(vPassword),
`recoverPass` = FALSE
WHERE id = vSelf;
END$$
DELIMITER ;