7 $user = $auth->getLoggedInUser();
8 $username = $auth->getLoggedInUsername();
10 if ( !$user or !$username ){
18 if ( !@$_POST[
'--password1'] || !@$_POST[
'--password2'] ){
19 throw new Exception(
"Please enter your new password in both fields provided.");
22 if ( !@$_POST[
'--current-password'] ){
23 throw new Exception(
"Please enter your current password in the field provided.");
27 $_REQUEST[
'UserName'] = $username;
28 $_REQUEST[
'Password'] = $_POST[
'--current-password'];
30 if ( !$auth->checkCredentials() ){
31 throw new Exception(
"The password you entered is incorrect. Please try again.");
34 if ( strcmp($_POST[
'--password1'], $_POST[
'--password2'])!==0 ){
35 throw new Exception(
"Your new passwords don't match. Please ensure that you retype your new password correctly.");
39 $res = $auth->setPassword($_POST[
'--password1']);
43 'message'=>
'Your password has been successfully changed'
46 }
catch (Exception $ex){
48 'code'=> $ex->getCode(),
49 'message'=>$ex->getMessage()
57 $jt->import(
'change_password.js');
59 df_display(array(),
'change_password.html');
67 function out($params){
69 echo json_encode($params);