-
Notifications
You must be signed in to change notification settings - Fork 907
Dynamic Location Validation Approach #2200
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
Dynamic Location Validation Approach #2200
Conversation
This document explains the User Location Validator solution, detailing how it restricts form submissions based on user location.
This document explains the User Location Validator solution, which restricts ServiceNow form submissions based on user location. It details the functionality of the Script Include and Client Script involved in the validation process.
Updated the README to clarify the User Location Validator functionality, including details on how it works, sample output, and usage notes.
Updated the readme to clarify the functionality and usage of the User Location Validator script, including details on how it works and sample output.
…tion Approach/Readme.md
…tion Approach/UserLocationUtils.js
|
@Charanjet please provide a valid title and description for your PR. |
Hello @kmohit2809 , |
Thanks @Charanjet , could you please make the readme more descriptive. Could you pkease shed some light on why the formula has been used this way to calculate the geo location and why is earth's circumference important in this? This will help others to understand your code better and utilise it when necessary. Thanks for your contribution. Once you make those changes then I should be able to merge this PR. |
SapphicFire
left a comment
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.
Looks good to me! Thank you for your contribution
| var a = Math.sin(deltaLatitude / 2) * Math.sin(deltaLatitude / 2) + | ||
| Math.cos(allowedLatitude * Math.PI / 180) * | ||
| Math.cos(currentLatitude * Math.PI / 180) * | ||
| Math.sin(deltaLongitude / 2) * Math.sin(deltaLongitude / 2); | ||
|
|
||
| var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); |
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.
Haversine! Love to see this
The description is solid for this contribution :) |
PR Description:
Adds a dynamic user location validation script, comparing browser geolocation against the user’s assigned location in ServiceNow. Includes both a server-side Script Include and client-side Validator to block form submission if the user is outside the approved area. Folder references for both components are provided in the README.
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions