Turn on account confirmation for blazor server app template (#13559)
This commit is contained in:
parent
f1f615282d
commit
ecb7288884
|
|
@ -67,7 +67,7 @@ namespace BlazorServerWeb_CSharp
|
||||||
options.UseSqlite(
|
options.UseSqlite(
|
||||||
Configuration.GetConnectionString("DefaultConnection")));
|
Configuration.GetConnectionString("DefaultConnection")));
|
||||||
#endif
|
#endif
|
||||||
services.AddDefaultIdentity<IdentityUser>()
|
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||||
#elif (OrganizationalAuth)
|
#elif (OrganizationalAuth)
|
||||||
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
|
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Company.WebApplication1
|
||||||
Configuration.GetConnectionString("DefaultConnection")));
|
Configuration.GetConnectionString("DefaultConnection")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
services.AddDefaultIdentity<ApplicationUser>()
|
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||||
|
|
||||||
services.AddIdentityServer()
|
services.AddIdentityServer()
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Company.WebApplication1
|
||||||
Configuration.GetConnectionString("DefaultConnection")));
|
Configuration.GetConnectionString("DefaultConnection")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
services.AddDefaultIdentity<ApplicationUser>()
|
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||||
|
|
||||||
services.AddIdentityServer()
|
services.AddIdentityServer()
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,23 @@ namespace Templates.Test.SpaTemplateTest
|
||||||
browser.FindElement(By.Name("Input.Password")).SendKeys(password);
|
browser.FindElement(By.Name("Input.Password")).SendKeys(password);
|
||||||
browser.FindElement(By.Name("Input.ConfirmPassword")).SendKeys(password);
|
browser.FindElement(By.Name("Input.ConfirmPassword")).SendKeys(password);
|
||||||
browser.FindElement(By.Id("registerSubmit")).Click();
|
browser.FindElement(By.Id("registerSubmit")).Click();
|
||||||
|
|
||||||
|
// We will be redirected to the RegisterConfirmation
|
||||||
|
browser.Contains("/Identity/Account/RegisterConfirmation", () => browser.Url);
|
||||||
|
browser.FindElement(By.PartialLinkText("Click here to confirm your account")).Click();
|
||||||
|
|
||||||
|
// We will be redirected to the ConfirmEmail
|
||||||
|
browser.Contains("/Identity/Account/ConfirmEmail", () => browser.Url);
|
||||||
|
|
||||||
|
// Now we can login
|
||||||
|
browser.FindElement(By.PartialLinkText("Login")).Click();
|
||||||
|
browser.Exists(By.Name("Input.Email"));
|
||||||
|
browser.FindElement(By.Name("Input.Email")).SendKeys(userName);
|
||||||
|
browser.FindElement(By.Name("Input.Password")).SendKeys(password);
|
||||||
|
browser.FindElement(By.Id("login-submit")).Click();
|
||||||
|
|
||||||
|
// Need to navigate to fetch page
|
||||||
|
browser.FindElement(By.PartialLinkText("Fetch data")).Click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can navigate to the 'fetch data' page
|
// Can navigate to the 'fetch data' page
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue