feat: /api/users/reset
This commit is contained in:
parent
8dd1044d8b
commit
41e61d772e
|
@ -47,4 +47,15 @@ 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->password = Hash::make($request->input('password'));
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue