diff --git a/cicm_web/Areas/Identity/IdentityHostingStartup.cs b/cicm_web/Areas/Identity/IdentityHostingStartup.cs
index 16222e02..9911c64e 100644
--- a/cicm_web/Areas/Identity/IdentityHostingStartup.cs
+++ b/cicm_web/Areas/Identity/IdentityHostingStartup.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
@@ -28,8 +28,12 @@
// Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/
+using Cicm.Database.Models;
using cicm_web.Areas.Identity;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
[assembly: HostingStartup(typeof(IdentityHostingStartup))]
@@ -39,7 +43,15 @@ namespace cicm_web.Areas.Identity
{
public void Configure(IWebHostBuilder builder)
{
- builder.ConfigureServices((context, services) => { });
+ builder.ConfigureServices((context, services) =>
+ {
+ services.AddDbContext(options => options
+ .UseLazyLoadingProxies()
+ .UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm"));
+
+ services.AddDefaultIdentity().AddRoles()
+ .AddEntityFrameworkStores();
+ });
}
}
}
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml b/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml
index 236ac9dd..27b60c7b 100644
--- a/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml
@@ -38,4 +38,4 @@
+
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs b/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs
index 98d71c57..b54fec02 100644
--- a/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs
+++ b/cicm_web/Areas/Identity/Pages/Account/AccessDenied.cshtml.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
diff --git a/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml b/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml
index c529d5f3..bd58c3ee 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml
@@ -35,9 +35,9 @@
ViewData["Title"] = "Confirm email";
}
-@ViewData["Title"]
+@ViewData["Title"]
Thank you for confirming your email.
-
+
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs b/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs
index 4a2dedff..f0642021 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs
+++ b/cicm_web/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
diff --git a/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml b/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml
index 9bdc4f23..03b471c3 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml
@@ -35,7 +35,7 @@
ViewData["Title"] = "Register";
}
-@ViewData["Title"]
+@ViewData["Title"]
Associate your @Model.LoginProvider account.
@@ -47,19 +47,28 @@
@section Scripts {
-}
-
+}
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs b/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs
index f9d4ad88..4652f6f1 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs
+++ b/cicm_web/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
diff --git a/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml b/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml
index f67cb9ec..121bedf8 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml
@@ -35,23 +35,31 @@
ViewData["Title"] = "Forgot your password?";
}
-@ViewData["Title"]
+@ViewData["Title"]
Enter your email.
@section Scripts {
-}
+}
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs b/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs
index e77eae75..593c752a 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs
+++ b/cicm_web/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
@@ -56,24 +56,22 @@ namespace cicm_web.Areas.Identity.Pages.Account
public async Task OnPostAsync()
{
- if(ModelState.IsValid)
- {
- IdentityUser user = await _userManager.FindByEmailAsync(Input.Email);
- if(user == null || !await _userManager.IsEmailConfirmedAsync(user))
- return RedirectToPage("./ForgotPasswordConfirmation");
-
- // For more information on how to enable account confirmation and password reset please
- // visit https://go.microsoft.com/fwlink/?LinkID=532713
- string code = await _userManager.GeneratePasswordResetTokenAsync(user);
- string callbackUrl = Url.Page("/Account/ResetPassword", null, new {code}, Request.Scheme);
-
- await _emailSender.SendEmailAsync(Input.Email, "Reset Password",
- $"Please reset your password by clicking here.");
+ if(!ModelState.IsValid) return Page();
+ IdentityUser user = await _userManager.FindByEmailAsync(Input.Email);
+ if(user == null || !await _userManager.IsEmailConfirmedAsync(user))
+ // Don't reveal that the user does not exist or is not confirmed
return RedirectToPage("./ForgotPasswordConfirmation");
- }
- return Page();
+ // For more information on how to enable account confirmation and password reset please
+ // visit https://go.microsoft.com/fwlink/?LinkID=532713
+ string code = await _userManager.GeneratePasswordResetTokenAsync(user);
+ string callbackUrl = Url.Page("/Account/ResetPassword", null, new {code}, Request.Scheme);
+
+ await _emailSender.SendEmailAsync(Input.Email, "Reset Password",
+ $"Please reset your password by clicking here.");
+
+ return RedirectToPage("./ForgotPasswordConfirmation");
}
public class InputModel
diff --git a/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml b/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml
index 3c750220..7287b29e 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml
@@ -35,8 +35,7 @@
ViewData["Title"] = "Forgot password confirmation";
}
-@ViewData["Title"]
+@ViewData["Title"]
Please check your email to reset your password.
-
-
+
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs b/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs
index 297db5e0..b684fdd5 100644
--- a/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs
+++ b/cicm_web/Areas/Identity/Pages/Account/ForgotPasswordConfirmation.cshtml.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
diff --git a/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml b/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml
index cddca71f..c49b50ca 100644
--- a/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml
@@ -38,4 +38,4 @@
+
\ No newline at end of file
diff --git a/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml.cs b/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml.cs
index 01710541..74374a3e 100644
--- a/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml.cs
+++ b/cicm_web/Areas/Identity/Pages/Account/Lockout.cshtml.cs
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
diff --git a/cicm_web/Areas/Identity/Pages/Account/Login.cshtml b/cicm_web/Areas/Identity/Pages/Account/Login.cshtml
index c36425d6..9fa347d6 100644
--- a/cicm_web/Areas/Identity/Pages/Account/Login.cshtml
+++ b/cicm_web/Areas/Identity/Pages/Account/Login.cshtml
@@ -30,29 +30,39 @@
*******************************************************************************/
}
@page
+@using Microsoft.AspNetCore.Authentication
@model LoginModel
@{
ViewData["Title"] = "Log in";
}
-@ViewData["Title"]
+@ViewData["Title"]
-
@@ -81,7 +100,7 @@
Use another service to log in.
@{
- if ((Model.ExternalLogins?.Count ?? 0) == 0)
+ if((Model.ExternalLogins?.Count ?? 0) == 0)
{
@@ -92,12 +111,21 @@
}
else
{
-