I have a login form where am accepting Mobile Number of the User for login.
When Mobile Number is submitted, am calling a JavaScript to validate the Mobile Number. My client side validations consist of checks like does Mobile Number starts with 9, 8 or 7, is the length of Mobile Number equals 10, etc.
Once these kinds of validations are done, am checking at Server side if entered Mobile Number and password matches(Authentication).
Since I have some checks in JavaScript, one can view the source and come to know that these kind of checks are there. And one can modify this code and let that to reflect for all Users. For eg., one can change the code which does the check if Mobile Number starts with 9, 8 or 7 and replace 9 with 1(say). So, if one enters Number starting with 9 it will fail.
How to prevent these kinds of attacks? An obvious way is to put these checks at the server side, but I have at least 10 different checks and I don't want to overload server-side checks.
How can attacker change those values in my JavaScript and let that to reflect for all Users?
EDIT : My client side JavaScript code looks like below,
var checkMobileNumber = form.mobileNumber.value;
if (checkMobileNumber.charAt(0) != 9 && checkMobileNumber.charAt(0) != 8 && checkMobileNumber.charAt(0) != 7) {
//Throw some error
}