mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
allow to disable user registration from env
This commit is contained in:
parent
5fa7321575
commit
417ac64ad2
@ -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)
|
||||
{
|
||||
|
@ -390,12 +390,13 @@ globalSettings__installation__id={_installationId}
|
||||
globalSettings__installation__key={_installationKey}
|
||||
globalSettings__yubico__clientId=REPLACE
|
||||
globalSettings__yubico__key=REPLACE
|
||||
globalSettings__mail__replyToEmail=hello@bitwarden.com
|
||||
globalSettings__mail__replyToEmail=no-reply@{_domain}
|
||||
globalSettings__mail__smtp__host=REPLACE
|
||||
globalSettings__mail__smtp__username=REPLACE
|
||||
globalSettings__mail__smtp__password=REPLACE
|
||||
globalSettings__mail__smtp__ssl=true
|
||||
globalSettings__mail__smtp__port=587");
|
||||
globalSettings__mail__smtp__port=587
|
||||
globalSettings__disableUserRegistration=false");
|
||||
|
||||
if(!_push)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user