feat: improve login process by integrating GPS location tracking and optimizing IP address handling, enhancing user data accuracy and experience
This commit is contained in:
@@ -132,6 +132,37 @@
|
||||
function formatarLocalizacao(login: any): string {
|
||||
if (!login || typeof login !== 'object') return "-";
|
||||
|
||||
// Priorizar localização GPS (mais precisa) quando disponível
|
||||
const usarGPS = login.latitudeGPS && login.longitudeGPS;
|
||||
|
||||
if (usarGPS) {
|
||||
const partes: string[] = [];
|
||||
if (login.cidadeGPS && typeof login.cidadeGPS === 'string' && login.cidadeGPS.trim()) {
|
||||
partes.push(login.cidadeGPS.trim());
|
||||
}
|
||||
if (login.estadoGPS && typeof login.estadoGPS === 'string' && login.estadoGPS.trim()) {
|
||||
partes.push(login.estadoGPS.trim());
|
||||
}
|
||||
if (login.paisGPS && typeof login.paisGPS === 'string' && login.paisGPS.trim()) {
|
||||
partes.push(login.paisGPS.trim());
|
||||
}
|
||||
|
||||
if (partes.length > 0) {
|
||||
return `${partes.join(", ")} (GPS)`;
|
||||
}
|
||||
|
||||
// Se não tiver cidade/estado/pais GPS, mas tiver endereco GPS, mostrar endereco
|
||||
if (login.enderecoGPS && typeof login.enderecoGPS === 'string' && login.enderecoGPS.trim()) {
|
||||
return `${login.enderecoGPS.trim()} (GPS)`;
|
||||
}
|
||||
|
||||
// Se tiver coordenadas mas não endereço, mostrar coordenadas
|
||||
if (login.latitudeGPS && login.longitudeGPS) {
|
||||
return `${login.latitudeGPS.toFixed(6)}, ${login.longitudeGPS.toFixed(6)} (GPS)`;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback para localização por IP
|
||||
const partes: string[] = [];
|
||||
if (login.cidade && typeof login.cidade === 'string' && login.cidade.trim()) {
|
||||
partes.push(login.cidade.trim());
|
||||
|
||||
Reference in New Issue
Block a user