feat: /api/users/reset

This commit is contained in:
b1ek 2024-08-29 21:10:02 +10:00
parent 8dd1044d8b
commit 41e61d772e
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 12 additions and 0 deletions

View File

@ -47,4 +47,15 @@ class PublicUserController extends Controller
return response()
->json('bad_password', 400);
}
public function reset(Request $request)
{
$user = User::where([ 'email' => $request->input('email') ])->get();
if ($user->count() == 0) {
return;
}
$user->password = Hash::make($request->input('password'));
$user->save();
}
}

View File

@ -11,6 +11,7 @@ Route::prefix('/api')->group(function() {
Route::controller(PublicUserController::class)->prefix('/users')->group(function() {
Route::put('/register', 'register');
Route::post('/login', 'login');
Route::post('/reset', 'reset');
});
});