mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Make logic clearer, improve comments
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
This commit is contained in:
parent
7ce94121ad
commit
ad367e8edb
|
|
@ -63,7 +63,7 @@ func VerifyUserFromRequest(
|
|||
return dev.UserID, nil
|
||||
}
|
||||
|
||||
// Try to find Application Service user
|
||||
// Try to find the Application Service user
|
||||
token, err := extractAccessToken(req)
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -96,14 +96,8 @@ func VerifyUserFromRequest(
|
|||
// Verify that the user is registered
|
||||
account, accountErr := accountDB.GetAccountByLocalpart(req.Context(), localpart)
|
||||
|
||||
if accountErr != nil {
|
||||
return "", &util.JSONResponse{
|
||||
Code: http.StatusForbidden,
|
||||
JSON: jsonerror.Forbidden("Application service has not registered this user"),
|
||||
}
|
||||
}
|
||||
|
||||
if account.AppServiceID == appService.ID {
|
||||
// Verify that account exists & appServiceID matches
|
||||
if accountErr == nil && account.AppServiceID == appService.ID {
|
||||
return userID, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue