mirror of
https://github.com/bitwarden/server
synced 2025-12-12 14:23:38 +00: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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user