-
Notifications
You must be signed in to change notification settings - Fork 0
Added e-mail and password updating #66
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
Conversation
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.
Pull Request Overview
This PR adds functionality for users to update their email address and password through the profile view. The changes include new backend API endpoints, service methods, and a redesigned frontend profile interface with collapsible forms for updating credentials.
Key Changes:
- Added
UserServicewith methods to get/update email and password - Created new REST endpoints in
UserResourcefor email and password updates - Implemented UI forms in
ProfileView.vuewith validation and loading states - Refactored
UserLoginExceptiontoUserAuthenticationExceptionfor broader authentication error handling
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java |
New service class with email/password update logic and user authentication |
app/src/main/java/dev/blaauwendraad/recipe_book/web/UserResource.java |
New REST resource providing endpoints for email/password operations with authorization checks |
app/src/main/java/dev/blaauwendraad/recipe_book/web/model/UpdateEmailRequest.java |
Request DTO for email updates with validation annotations |
app/src/main/java/dev/blaauwendraad/recipe_book/web/model/UpdatePasswordRequest.java |
Request DTO for password updates with validation annotations |
app/src/main/java/dev/blaauwendraad/recipe_book/service/exception/UserAuthenticationException.java |
Renamed exception class (formerly UserLoginException) for authentication errors |
app/src/main/java/dev/blaauwendraad/recipe_book/service/exception/UserAuthenticationExceptionMapper.java |
Updated mapper to handle renamed exception with improved error message |
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserAuthenticationService.java |
Updated to throw renamed UserAuthenticationException |
app/src/main/java/dev/blaauwendraad/recipe_book/web/UserAuthenticationResource.java |
Updated login endpoint to throw renamed UserAuthenticationException |
app/src/test/java/dev/blaauwendraad/recipe_book/service/UserAuthenticationTest.java |
Updated test to reference renamed UserAuthenticationException |
app/src/main/java/dev/blaauwendraad/recipe_book/web/model/SaveRecipeRequestDto.java |
Removed duplicate @NotNull annotation from numServings field |
ui/src/api/userApi.ts |
New API client functions for email/password operations with error handling |
ui/src/components/ProfileView.vue |
Enhanced profile view with collapsible email/password update forms including validation and feedback |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java
Show resolved
Hide resolved
app/src/main/java/dev/blaauwendraad/recipe_book/web/UserResource.java
Outdated
Show resolved
Hide resolved
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java
Outdated
Show resolved
Hide resolved
24b1a89 to
26a8027
Compare
26a8027 to
f7c6b5b
Compare
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java
Outdated
Show resolved
Hide resolved
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java
Show resolved
Hide resolved
...c/main/java/dev/blaauwendraad/recipe_book/service/exception/UserAuthenticationException.java
Outdated
Show resolved
Hide resolved
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java
Outdated
Show resolved
Hide resolved
app/src/main/java/dev/blaauwendraad/recipe_book/service/UserService.java
Outdated
Show resolved
Hide resolved
app/src/main/java/dev/blaauwendraad/recipe_book/web/UserResource.java
Outdated
Show resolved
Hide resolved
app/src/test/java/dev/blaauwendraad/recipe_book/service/UserAuthenticationTest.java
Show resolved
Hide resolved
| } catch (error) { | ||
| console.error("Error fetching user: ", error); | ||
| throw error; | ||
| } |
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.
Why does this not have the if (error instanceof HttpError) like the ones below?
ui/src/api/userApi.ts
Outdated
| export const updateEmail = async (userId: number, newEmail: string, currentPassword: string): Promise<void> => { | ||
| try { | ||
| return await put(`/users/${userId}/email`, { newEmail, currentPassword }, {auth: "accessToken"}); | ||
| } catch (error) { | ||
| if(error instanceof HttpError) { | ||
| throw new Error(error.data.detail); |
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.
Why are all these functions duplicated in both userAccountApi and userApi??
2dd97f4 to
a81faf8
Compare
No description provided.