mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
allow to disable user registration from env
This commit is contained in:
@ -11,6 +11,7 @@ namespace Bit.Core
|
||||
public virtual string LogDirectory { get; set; }
|
||||
public virtual string LicenseDirectory { get; set; }
|
||||
public virtual string PushRelayBaseUri { get; set; }
|
||||
public virtual bool DisableUserRegistration { get; set; }
|
||||
public virtual InstallationSettings Installation { get; set; } = new InstallationSettings();
|
||||
public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings();
|
||||
public virtual SqlServerSettings SqlServer { get; set; } = new SqlServerSettings();
|
||||
|
@ -206,6 +206,11 @@ namespace Bit.Core.Services
|
||||
|
||||
public async Task<IdentityResult> RegisterUserAsync(User user, string masterPassword)
|
||||
{
|
||||
if(_globalSettings.DisableUserRegistration)
|
||||
{
|
||||
throw new BadRequestException("Registration has been disabled by the system administrator.");
|
||||
}
|
||||
|
||||
var result = await base.CreateAsync(user, masterPassword);
|
||||
if(result == IdentityResult.Success)
|
||||
{
|
||||
|
Reference in New Issue
Block a user