fix: sign-in broken due to wrong field name on auth response
The /user/authenticate endpoint returns 'user_id' not 'user_id_random'. Both auth flows (user_id+auth_key and username+password) were checking user_response?.user_id_random, which was always undefined, causing the user_id to never be set and falling through to the email lookup fallback. Fixed both .then() handlers to check user_response?.user_id and assign user_obj.user_id.
This commit is contained in:
@@ -469,13 +469,13 @@
|
||||
})
|
||||
.then((user_response) => {
|
||||
// console.log(`HERE:`, user_response);
|
||||
if (user_response?.user_id_random) {
|
||||
if (user_response?.user_id) {
|
||||
console.log(
|
||||
`Successfully authenticated in with User ID and User Auth Key: ${user_response.username}`,
|
||||
user_response
|
||||
);
|
||||
user_obj = user_response; // Store the user object for later use
|
||||
user_id = user_obj.user_id_random; // Use the user_id_random for further API calls
|
||||
user_id = user_obj.user_id; // Use the user_id for further API calls
|
||||
// person_id = user_obj.person_id_random;
|
||||
} else {
|
||||
alert('Failed to authenticate: ' + (user_response?.error || 'Unknown error'));
|
||||
@@ -576,13 +576,13 @@
|
||||
log_lvl: 1
|
||||
})
|
||||
.then((user_response) => {
|
||||
if (user_response?.user_id_random) {
|
||||
if (user_response?.user_id) {
|
||||
console.log(
|
||||
`Successfully authenticated in with Username (${user_response.username}) and Password:`,
|
||||
user_response
|
||||
);
|
||||
user_obj = user_response; // Store the user object for later use
|
||||
user_id = user_obj.user_id_random; // Use the user_id_random for further API calls
|
||||
user_id = user_obj.user_id; // Use the user_id for further API calls
|
||||
// person_id = user_obj.person_id_random;
|
||||
} else {
|
||||
alert('Failed to authenticate: ' + (user_response?.error || 'Unknown error'));
|
||||
|
||||
Reference in New Issue
Block a user