Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: first_name single quote broke mariadb sql #7400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/Actions/AttemptToAuthenticateSocialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ private function getUserOrCreate(SocialiteUser $socialite): User
private function createUser(SocialiteUser $socialite): User
{
$names = Str::of($socialite->getName())->split('/ /', 2);
$names = Str::of($socialite->getName())->split('/ /', 2);

$firstName = addslashes($names[0]);
$lastName = addslashes($names[1] ?? $names[0]);
$data = [
'email' => $socialite->getEmail(),
'first_name' => $names[0],
'last_name' => $names[1] ?? $names[0],
'first_name' => $firstName,
'last_name' => $lastName,
'terms' => true,
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ public function create(Request $request, string $vaultId, string $contactId)

public function store(Request $request, string $vaultId, string $contactId)
{

$request->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'nullable|string|max:255',
'middle_name' => 'nullable|string|max:255',
'nickname' => 'nullable|string|max:255',
'maiden_name' => 'nullable|string|max:255',
'gender_id' => 'nullable|integer|exists:genders,id', // Assuming gender_id refers to a foreign key
'pronoun_id' => 'nullable|integer|exists:pronouns,id', // Assuming pronoun_id refers to a foreign key
'relationship_type_id' => 'required|integer|exists:relationship_types,id', // Assuming relationship_type_id refers to a foreign key
'create_contact_entry' => 'nullable|boolean',
'base_contact_id' => 'required|integer|exists:contacts,id',
'other_contact_id' => 'nullable|array', // Assuming multiple contacts might be selected
'other_contact_id.*' => 'integer|exists:contacts,id', // Validating each contact ID
]);
// This is a complex controller method, sorry about that, future reader
// It's complex because the form is really complex and can lead to
// many different scenarios
Expand Down