Commit Graph

5 Commits

Author SHA1 Message Date
119a34faae test: improve users edit tests
- Rename test for friendly forwarding to be more concise
- Add a separate test for successful user edit

These changes enhance the clarity of the test suite by
providing a more descriptive name for the friendly forwarding
test and separating the successful edit functionality into
its own test case, improving maintainability and readability.
2025-01-04 10:26:08 +08:00
712cd10894 style: standardize quotation marks and spacing
- Updated single quotes to double quotes for consistency
- Adjusted spacing in array definitions for better readability
- Ensured consistent use of quotes in flash messages and method parameters

These changes enhance the overall code style without altering any functionality.
2025-01-04 10:21:22 +08:00
2b03661431 feat: add user authentication and authorization
- Implement friendly forwarding for user login
- Add correct_user method to ensure users can only edit their own profiles
- Update sessions_controller to handle forwarding URL
- Enhance user controller tests to verify redirection for unauthorized access

These changes improve user experience by allowing users to be redirected
back to their intended page after logging in. Additionally, the new
correct_user method enhances security by preventing users from editing
other users' profiles, ensuring proper authorization checks are in place.
2025-01-03 13:48:59 +08:00
23992ec4b2 feat: add user authentication checks
- Implement before_action to ensure users are logged in
- Add logged_in_user method to handle redirection
- Update user fixture to include new user
- Enhance integration tests to check for login requirement

This commit introduces user authentication checks for the edit and
update actions in the UsersController. It ensures that only logged-in
users can access these actions, improving the security of the
application. Additionally, integration tests have been updated to
verify that users are redirected to the login page if they attempt
to edit or update their information without being logged in.
2025-01-03 11:12:51 +08:00
978c44b682 feat: add user profile editing functionality
- Implemented edit and update actions in UsersController
- Created edit user view and form partial
- Updated user model validation to allow nil password
- Modified header to link to user settings
- Added integration tests for successful and unsuccessful edits

This commit introduces the ability for users to edit their profile
information, including name and email. It also includes validation
updates to allow users to update their profiles without changing
their password. Integration tests ensure that both successful and
unsuccessful edit attempts are handled correctly.
2025-01-03 10:55:42 +08:00