Skip to content

Commit 6f1f9af

Browse files
committed
[handlers] fix issues
1 parent bc425e1 commit 6f1f9af

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

api/requests.http

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ Content-Type: application/json
105105

106106
###
107107
GET {{baseUrl}}/3rdparty/v1/devices HTTP/1.1
108-
Authorization: Basic {{credentials}}
108+
# Authorization: Basic {{credentials}}
109+
Authorization: Bearer {{jwtToken}}
110+
109111

110112
###
111113
DELETE {{baseUrl}}/3rdparty/v1/devices/gF0jEYiaG_x9sI1YFWa7a HTTP/1.1
@@ -205,9 +207,9 @@ Content-Type: application/json
205207
"scopes": [
206208
"messages:send",
207209
"messages:read",
208-
"devices:read",
210+
"devices:list",
209211
"devices:write",
210-
"webhooks:read",
212+
"webhooks:list",
211213
"webhooks:write",
212214
"settings:read",
213215
"settings:write",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// Package messages defines permission scopes for message-related operations.
12
package messages
23

34
const (
5+
// ScopeSend is the permission scope required for sending messages.
46
ScopeSend = "messages:send"
7+
// ScopeRead is the permission scope required for reading individual messages.
58
ScopeRead = "messages:read"
9+
// ScopeList is the permission scope required for listing messages.
610
ScopeList = "messages:list"
711
)

internal/sms-gateway/handlers/mobile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func (h *mobileHandler) changePassword(device models.Device, c *fiber.Ctx) error
229229

230230
if err := h.usersSvc.ChangePassword(c.Context(), device.UserID, req.CurrentPassword, req.NewPassword); err != nil {
231231
h.Logger.Error("failed to change password", zap.Error(err))
232-
return fiber.NewError(fiber.StatusUnauthorized, "Invalid current password")
232+
return fiber.NewError(fiber.StatusUnauthorized, "failed to change password")
233233
}
234234

235235
return c.SendStatus(fiber.StatusNoContent)

internal/sms-gateway/handlers/thirdparty/auth.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ type tokenResponse struct {
5151

5252
// @Summary Generate token
5353
// @Description Generate new access token with specified scopes and ttl
54+
// @Security ApiAuth
55+
// @Security JWTAuth
5456
// @Tags User, Auth
5557
// @Accept json
5658
// @Produce json

0 commit comments

Comments
 (0)