diff --git a/public/site/config/config.php b/public/site/config/config.php index 7e92b30..c6cb731 100644 --- a/public/site/config/config.php +++ b/public/site/config/config.php @@ -33,6 +33,7 @@ return [ require(__DIR__ . '/routes/save-page.php'), require(__DIR__ . '/routes/save-file.php'), require(__DIR__ . '/routes/remove-file.php'), + require(__DIR__ . '/routes/update-password.php'), require(__DIR__ . '/routes/upload-pdf.php'), require(__DIR__ . '/routes/validate-brief.php'), require(__DIR__ . '/routes/request-project-creation.php'), diff --git a/public/site/config/routes/update-password.php b/public/site/config/routes/update-password.php new file mode 100644 index 0000000..001b0dc --- /dev/null +++ b/public/site/config/routes/update-password.php @@ -0,0 +1,22 @@ + '/update-password.json', + 'method' => 'POST', + 'action' => function() { + $json = file_get_contents("php://input"); + $data = json_decode($json); + + try { + kirby()->user()->changePassword($data->password); + return [ + 'status' => 'success' + ]; + } catch (\Throwable $th) { + return [ + 'status' => 'error', + 'message' => 'Impossible de mettre à jour le mot de passe : ' . $th->getMessage() . ' in file ' . $th->getFile() . ' line ' . $th->getLine() + ]; + } + } +]; \ No newline at end of file diff --git a/src/views/Account.vue b/src/views/Account.vue index 86a3ade..0bf10d4 100644 --- a/src/views/Account.vue +++ b/src/views/Account.vue @@ -17,7 +17,13 @@ required />
Email : {{ user.email }}
- + @@ -43,9 +49,11 @@ />