GWM : token fetch
This commit is contained in:
parent
b5d0bfabd8
commit
603e7e8c69
13
main.go
13
main.go
@ -1727,9 +1727,15 @@ func main() {
|
|||||||
// Try to find user by UUID (emiratesid)
|
// Try to find user by UUID (emiratesid)
|
||||||
user, err := e.App.Dao().FindFirstRecordByData("users", "emiratesid", requestData.UUID)
|
user, err := e.App.Dao().FindFirstRecordByData("users", "emiratesid", requestData.UUID)
|
||||||
if err == nil && user != nil {
|
if err == nil && user != nil {
|
||||||
|
// Generate auth token for the user
|
||||||
|
token, tokenErr := e.App.NewRecordAuthToken(user)
|
||||||
|
if tokenErr != nil {
|
||||||
|
// log message here
|
||||||
|
}
|
||||||
return c.JSON(http.StatusOK, map[string]interface{}{
|
return c.JSON(http.StatusOK, map[string]interface{}{
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"message": "User found by UUID",
|
"message": "User found by UUID",
|
||||||
|
"token": token,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,10 +1758,17 @@ func main() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate auth token for the user
|
||||||
|
token2, tokenErr2 := e.App.NewRecordAuthToken(userByEmail)
|
||||||
|
if tokenErr2 != nil {
|
||||||
|
// log message here
|
||||||
|
}
|
||||||
|
|
||||||
// Return success after update
|
// Return success after update
|
||||||
return c.JSON(http.StatusOK, map[string]interface{}{
|
return c.JSON(http.StatusOK, map[string]interface{}{
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"message": "User found by email and UUID updated successfully",
|
"message": "User found by email and UUID updated successfully",
|
||||||
|
"token": token2,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user