Mahitha taking over: complete server date protection for timelog and weekly summary#5390
Open
Mahitha-pasupuleti wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Implements: #4312 (Priority: High)

This PR resolves the issue where users could bypass time entry validation by changing their local system date. Previously, the frontend relied on the client's local time, allowing users to log time for incorrect dates by modifying their device clock.
This implementation updates the frontend to fetch the current server time before creating a time entry. Time entry validation now uses the server date instead of the local system date, preventing users from logging time on dates other than the current server date.
Related Issue
Related PRs
To test this feature, check out both the frontend and backend PRs.
Main changes explained
serverTimeutility to retrieve the current backend server time.postTimeEntry()to fetch the latest server time before submitting a time entry.How to test
Check out both the frontend and backend branches.
Run:
Clear the browser cache/site data.
Log in as an admin user.
Navigate to Dashboard → Tasks → Select a task → Log Time.
Verify that logging time for the current server date succeeds.
Change your computer's system date to a previous or future day.
Attempt to log time again.
Verify that:
Reset your system clock and verify that logging time for the current date works as expected.
Screenshots or Videos
Video demonstration:
https://youtu.be/ziEJpHzcmX8
Note
This PR depends on the corresponding backend PR, which introduces the
/api/servertimeendpoint used for server-based date validation.