Skip to content

Commit c0029f8

Browse files
committed
Update token validation error messages to "Invalid token"
1 parent 3397fa9 commit c0029f8

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

OpenBioCardServer/Controllers/Classic/ClassicAdminController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private async Task<IActionResult> GetUsersInternal(string token, string username
108108

109109
if (account.UserName != username)
110110
{
111-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
111+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
112112
}
113113

114114
if (!await _authService.HasAdminPermissionAsync(account))
@@ -154,7 +154,7 @@ public async Task<IActionResult> CreateUser([FromBody] ClassicCreateUserRequest
154154

155155
if (account.UserName != request.Username)
156156
{
157-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
157+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
158158
}
159159

160160
if (!await _authService.HasAdminPermissionAsync(account))
@@ -244,7 +244,7 @@ public async Task<IActionResult> DeleteUser(string targetUsername, [FromBody] Cl
244244

245245
if (account.UserName != request.Username)
246246
{
247-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
247+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
248248
}
249249

250250
if (!await _authService.HasAdminPermissionAsync(account))

OpenBioCardServer/Controllers/Classic/ClassicAuthController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public async Task<IActionResult> DeleteAccount([FromBody] ClassicDeleteRequest r
203203

204204
if (account.UserName != request.Username)
205205
{
206-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
206+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
207207
}
208208

209209
// Root account cannot be deleted

OpenBioCardServer/Controllers/Classic/ClassicSettingsController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public async Task<IActionResult> GetAdminSettings([FromBody] ClassicAdminRequest
9090

9191
if (account.UserName != request.Username)
9292
{
93-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
93+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
9494
}
9595

9696
if (!await _authService.HasAdminPermissionAsync(account))
@@ -135,7 +135,7 @@ public async Task<IActionResult> UpdateSettings([FromBody] ClassicUpdateSettings
135135

136136
if (account.UserName != request.Username)
137137
{
138-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
138+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
139139
}
140140

141141
if (!await _authService.HasAdminPermissionAsync(account))

OpenBioCardServer/Controllers/Classic/ClassicUserController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public async Task<IActionResult> UpdateProfile(string username, [FromBody] Class
7272

7373
if (account.UserName != username)
7474
{
75-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
75+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
7676
}
7777

7878
try
@@ -115,7 +115,7 @@ public async Task<IActionResult> ExportData(string username)
115115

116116
if (account.UserName != username)
117117
{
118-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
118+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
119119
}
120120

121121
try
@@ -158,7 +158,7 @@ public async Task<IActionResult> ImportData(string username, [FromBody] ClassicU
158158

159159
if (account.UserName != username)
160160
{
161-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
161+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
162162
}
163163

164164
try

0 commit comments

Comments
 (0)