3 include_once
"FDL/freedom_util.php";
24 $oldPassword =
$usage->addRequiredParameter(
"old_password",
"old password value");
25 $newPassword1 =
$usage->addRequiredParameter(
"new_password_1",
"new password");
26 $newPassword2 =
$usage->addRequiredParameter(
"new_password_2",
"new password verif value");
28 $usage->setStrictMode(
false);
35 throw new Exception(_(
"CHANGE_PASSWORD:You can't modify your account"));
38 if (!$action->user->checkpassword($oldPassword)) {
39 throw new Exception(_(
"CHANGE_PASSWORD:The old password is not good"));
42 $err =
$user->constraintPassword($newPassword1, $newPassword2, $action->user->login);
43 if (isset(
$err[
"err"]) && !empty(
$err[
"err"])) {
44 throw new Exception(sprintf(_(
"CHANGE_PASSWORD:The provided password is not good (%s)"),
$err[
"err"]));
47 $err =
$user->testForcePassword($newPassword1);
49 throw new Exception(sprintf(_(
"CHANGE_PASSWORD:The provided password is not good (%s)"),
$err));
54 throw new Exception(sprintf(_(
"CHANGE_PASSWORD:Unable to change password (%s)"),
$err));
57 }
catch (Exception $e) {
58 $return[
"success"] =
false;
59 $return[
"error"][] = $e->getMessage();
60 unset($return[
"data"]);
63 $action->lay->template = json_encode($return);
64 $action->lay->noparse =
true;
65 header(
'Content-type: application/json');
change_user_password(Action &$action)
Verify arguments for action function.
new_Doc($dbaccess, $id= '', $latest=false)
if($file) if($subject==""&&$file) if($subject=="") $err