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

feat: add endpoints for fetching and updating user data, add validati… #6

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

frooooooo7
Copy link
Contributor

…on rules

return [
'name' => 'string|min:2|max:30|regex:/^[a-zA-ZÀ-ž\s\'-]+$/',
'last_name' => 'string|min:2|max:30|regex:/^[a-zA-ZÀ-ž\s\'-]+$/',
'email' => 'email|max:255',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dodaj tutaj również unique

Comment on lines 28 to 33

$table->string('card_first_name')->nullable();
$table->string('card_last_name')->nullable();
$table->string('card_number')->nullable();
$table->string('card_expiry_date')->nullable();
$table->string('card_cvv')->nullable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Przenieść do oddzielenej tabeli z relacją 1:1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zadbać o odpowiednie przechowywanie danych, ich zwracanie oraz szyfrowanie

Comment on lines 80 to 90
$data = $request->validated();
$user = auth()->user();

try {
$user->update($data);
}
catch (Exception $e)
{
return response()->json(['message' => "Failed to update user's profile!"], Response::HTTP_INTERNAL_SERVER_ERROR);
}
return response()->json(['success' => true], Response::HTTP_OK);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Użycie struktury stworzonej w Course

frooooooo7 and others added 2 commits December 18, 2024 13:28
- change structures in controllers
- card informations move to seperated table
- ensure that data is properly stored, returned and encrypted
return [
'name' => 'string|min:2|max:30|regex:/^[a-zA-ZÀ-ž\s\'-]+$/',
'last_name' => 'string|min:2|max:30|regex:/^[a-zA-ZÀ-ž\s\'-]+$/',
'email' => 'email|max:255|unique:users,email',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sprawdz proszę jak zachowa się kontroler kiedy podasz ten sam email w update

Comment on lines +32 to +35
private function maskCvv(string $cvv): string
{
return str_repeat('*', strlen($cvv));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Czy cvv nie powinien zachowywać się podobnie jak hasło, tzn ze nie jest dostępne w resource, a przy potwierdzaniu transakcji podawany jest cvv i sprawdzany hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants