code cleanup
This commit is contained in:
parent
34d0c3c4fe
commit
e8eee642c2
4 changed files with 13 additions and 218 deletions
|
|
@ -42,18 +42,8 @@ namespace isnd.Services
|
|||
using (var client = new SmtpClient())
|
||||
{
|
||||
client.ServerCertificateValidationCallback = (s,c,h,e)=>true;
|
||||
if (Env.IsDevelopment() || Options.UserName == null)
|
||||
{
|
||||
await client.ConnectAsync(Options.Server, Options.Port, MailKit.Security.SecureSocketOptions.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
await client.ConnectAsync(Options.Server);
|
||||
}
|
||||
if (Options.UserName != null)
|
||||
{
|
||||
await client.AuthenticateAsync(Options.UserName, Options.Password);
|
||||
}
|
||||
await client.ConnectAsync(Options.Server);
|
||||
await client.AuthenticateAsync(Options.UserName, Options.Password);
|
||||
await client.SendAsync(message);
|
||||
await client.DisconnectAsync(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ namespace isnd
|
|||
.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseNpgsql(
|
||||
Configuration.GetConnectionString("DefaultConnection")))
|
||||
.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
.AddRoles<IdentityRole>()
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||
.AddSignInManager()
|
||||
.AddDefaultUI()
|
||||
.AddDefaultTokenProviders();
|
||||
.AddSignInManager()
|
||||
.AddDefaultUI()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
services.AddMvc(o=>o.EnableEndpointRouting = false);
|
||||
services.AddMvc(o => o.EnableEndpointRouting = false);
|
||||
|
||||
services.AddDataProtection();
|
||||
|
||||
|
|
@ -106,9 +106,10 @@ namespace isnd
|
|||
});
|
||||
|
||||
services.AddControllersWithViews()
|
||||
.AddNewtonsoftJson(s => {
|
||||
s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver();
|
||||
} );
|
||||
.AddNewtonsoftJson(s =>
|
||||
{
|
||||
s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver();
|
||||
});
|
||||
services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
|
|
@ -136,8 +137,8 @@ namespace isnd
|
|||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app,
|
||||
IWebHostEnvironment env,
|
||||
ApplicationDbContext dbContext,
|
||||
IOptions<IsndSettings> isnSettingsOption )
|
||||
ApplicationDbContext dbContext,
|
||||
IOptions<IsndSettings> isnSettingsOption)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue