Compare commits

..

2 Commits

Author SHA1 Message Date
b1ek 7cd5f1c4da
fix: save password correctly 2024-08-29 21:14:35 +10:00
b1ek 41e61d772e
feat: /api/users/reset 2024-08-29 21:10:02 +10:00
2 changed files with 13 additions and 0 deletions

View File

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

View File

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