front > account : update password working
This commit is contained in:
parent
1e40c38805
commit
074084f867
3 changed files with 79 additions and 3 deletions
22
public/site/config/routes/update-password.php
Normal file
22
public/site/config/routes/update-password.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'pattern' => '/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()
|
||||
];
|
||||
}
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue