-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: dev
Are you sure you want to change the base?
Conversation
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', |
There was a problem hiding this comment.
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
|
||
$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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
$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); |
There was a problem hiding this comment.
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
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', |
There was a problem hiding this comment.
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
private function maskCvv(string $cvv): string | ||
{ | ||
return str_repeat('*', strlen($cvv)); | ||
} |
There was a problem hiding this comment.
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
…on rules