When the GPS on the phone is disabled, the user can manually select any point on the map. How can I remove this option to send location?
The variable res handles the distance between two points.
I will be very grateful.
Current code:
@dp.message_handler(state=UserState.location, content_types=['location'])
async def handle_location(message: types.Message, state: FSMContext):
user_loc1 = message.location.latitude
user_loc2 = message.location.longitude
data = await state.get_data()
org_loc1 = data['id_in_qr'][0]
org_loc2 = data['id_in_qr'][1]
res = geolocation.ras(user_loc1, user_loc2, org_loc1, org_loc2)
if res > 200 or not res:
await message.answer('Вы еще не дошли до работы', reply_markup=types.ReplyKeyboardRemove())
await UserState.location.set()
else:
await message.answer(f'Вы пришли на работу в ', reply_markup=types.ReplyKeyboardRemove())
await state.finish()
for file in glob.glob(f"data/{message.from_user.id}{message.date}.png"):
os.remove(file)
2
Answers
You can to try print on user screen the special button, which make request by user location. It is won’t decide your problem fully, but I think it`s some better. This variant also can be go around. As I know user in any case can send fake location.
Ah yes, the Big Brother daddy issues.
In a general case, you can’t prevent employees from faking their location without being far, far more intrusive. If they are circumventing your restrictions now, you will achieve precisely nothing by blocking this specific route.
If I control a device, I may not only select the location manually, I could also spoof it – sprawling communities were created for Pokemon Go, for example. This knowledge is pretty much widely available. You are dealing with a people problem here, not a tech problem.