feat: add email endpoint
This commit is contained in:
@ -214,6 +214,32 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost("SetEmail")]
|
||||
[TokenAuthentication]
|
||||
[BadRequestResponse]
|
||||
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request)
|
||||
{
|
||||
var settings = (request == null) switch
|
||||
{
|
||||
true => new EmailSettings(),
|
||||
false => new EmailSettings
|
||||
{
|
||||
Server = request.Server,
|
||||
From = request.From,
|
||||
Password = request.Password,
|
||||
Port = request.Port,
|
||||
Ssl = request.Ssl,
|
||||
User = request.User
|
||||
}
|
||||
};
|
||||
|
||||
var general = GeneralConfig;
|
||||
general.EmailSettings = settings;
|
||||
GeneralConfig = general;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user