fix: update response format for password reset methods and correct alert component in request sent page

This commit is contained in:
2025-11-06 14:19:35 +01:00
parent c030ac8971
commit 47d9daf727
2 changed files with 9 additions and 5 deletions

View File

@@ -114,7 +114,7 @@ class RegisteredUserController extends Controller
return response()->noContent(); return response()->noContent();
} }
public function reset_password(Request $request): Response public function reset_password(Request $request)
{ {
$request->validate([ $request->validate([
'email' => ['required', 'string', 'lowercase', 'email', 'max:255'], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255'],
@@ -122,7 +122,9 @@ class RegisteredUserController extends Controller
$user = User::whereEmail($request->email)->first(); $user = User::whereEmail($request->email)->first();
if (!$user) { if (!$user) {
return response(status: 400); return response()->json([
'message' => 'No such user exists.'
], 400);
} }
$newPassword = bin2hex(random_bytes(16)); $newPassword = bin2hex(random_bytes(16));
@@ -134,7 +136,7 @@ class RegisteredUserController extends Controller
return response()->noContent(); return response()->noContent();
} }
public function reset_password_2(Request $request): Response public function reset_password_2(Request $request)
{ {
$request->validate([ $request->validate([
'id' => ['required', 'string', 'lowercase', 'email', 'max:255'], 'id' => ['required', 'string', 'lowercase', 'email', 'max:255'],
@@ -143,7 +145,9 @@ class RegisteredUserController extends Controller
$user = User::whereEmail($request->email)->first(); $user = User::whereEmail($request->email)->first();
if (!$user) { if (!$user) {
return response(status: 400); return response()->json([
'message' => 'No such user exists.'
], 400);
} }
$user->password = Hash::make($request->password); $user->password = Hash::make($request->password);

View File

@@ -16,7 +16,7 @@ useSeoMeta({
<v-card id="page-container-card"> <v-card id="page-container-card">
<h2 class="page-title">Reset hesla</h2> <h2 class="page-title">Reset hesla</h2>
<InfoAlert title="Reset hesla" text="Nové heslo vám bolo zaslané na e-mail" /> <SuccessAlert title="Reset hesla" text="Nové heslo vám bolo zaslané na e-mail" />
</v-card> </v-card>
</v-container> </v-container>
</template> </template>