1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

[PM-1635] Invalid license error is inaccurate (#4631)

* Resolve the unclear error messages

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Refactor to return the errormessage from userLicense

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the pr comments

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* resolve the error returned message

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Add period at the end of error messages

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
cyprain-okeke
2024-08-26 14:12:58 +01:00
committed by GitHub
parent a5363c1513
commit e2ec1c4950
3 changed files with 66 additions and 31 deletions

View File

@ -891,9 +891,9 @@ public class UserService : UserManager<User>, IUserService, IDisposable
throw new BadRequestException("Invalid license.");
}
if (!license.CanUse(user))
if (!license.CanUse(user, out var exceptionMessage))
{
throw new BadRequestException("This license is not valid for this user.");
throw new BadRequestException(exceptionMessage);
}
var dir = $"{_globalSettings.LicenseDirectory}/user";
@ -960,9 +960,9 @@ public class UserService : UserManager<User>, IUserService, IDisposable
throw new BadRequestException("Invalid license.");
}
if (!license.CanUse(user))
if (!license.CanUse(user, out var exceptionMessage))
{
throw new BadRequestException("This license is not valid for this user.");
throw new BadRequestException(exceptionMessage);
}
var dir = $"{_globalSettings.LicenseDirectory}/user";