|
|
|
@ -20,7 +20,7 @@ using Microsoft.Data.Entity;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Yavsc.Controllers
|
|
|
|
namespace Yavsc.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
|
|
public class AccountController : Controller
|
|
|
|
public class AccountController : Controller
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly UserManager<ApplicationUser> _userManager;
|
|
|
|
private readonly UserManager<ApplicationUser> _userManager;
|
|
|
|
@ -61,6 +61,13 @@ namespace Yavsc.Controllers
|
|
|
|
_dbContext = dbContext;
|
|
|
|
_dbContext = dbContext;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Authorize(Roles=Constants.AdminGroupName)]
|
|
|
|
|
|
|
|
public async Task<IActionResult> UserList ()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return View(await _dbContext.Users.ToArrayAsync());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[HttpGet(Constants.LoginPath)]
|
|
|
|
[HttpGet(Constants.LoginPath)]
|
|
|
|
public ActionResult SignIn(string returnUrl = null)
|
|
|
|
public ActionResult SignIn(string returnUrl = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -79,6 +86,7 @@ namespace Yavsc.Controllers
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public ActionResult AccessDenied(string requestUrl = null)
|
|
|
|
public ActionResult AccessDenied(string requestUrl = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ViewBag.UserIsSignedIn = User.IsSignedIn();
|
|
|
|
ViewBag.UserIsSignedIn = User.IsSignedIn();
|
|
|
|
@ -89,6 +97,7 @@ namespace Yavsc.Controllers
|
|
|
|
return View("AccessDenied",requestUrl);
|
|
|
|
return View("AccessDenied",requestUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[HttpPost(Constants.LoginPath)]
|
|
|
|
[HttpPost(Constants.LoginPath)]
|
|
|
|
public async Task<IActionResult> SignIn(SignInViewModel model)
|
|
|
|
public async Task<IActionResult> SignIn(SignInViewModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -169,6 +178,7 @@ namespace Yavsc.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/Register
|
|
|
|
// GET: /Account/Register
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
public IActionResult Register()
|
|
|
|
public IActionResult Register()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -178,6 +188,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// POST: /Account/Register
|
|
|
|
// POST: /Account/Register
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
public async Task<IActionResult> Register(RegisterViewModel model)
|
|
|
|
public async Task<IActionResult> Register(RegisterViewModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -220,6 +231,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/ExternalLoginCallback
|
|
|
|
// GET: /Account/ExternalLoginCallback
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null)
|
|
|
|
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var info = await _signInManager.GetExternalLoginInfoAsync();
|
|
|
|
var info = await _signInManager.GetExternalLoginInfoAsync();
|
|
|
|
@ -285,6 +297,7 @@ namespace Yavsc.Controllers
|
|
|
|
// POST: /Account/ExternalLoginConfirmation
|
|
|
|
// POST: /Account/ExternalLoginConfirmation
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public async Task<IActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl = null)
|
|
|
|
public async Task<IActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (User.IsSignedIn())
|
|
|
|
if (User.IsSignedIn())
|
|
|
|
@ -324,6 +337,7 @@ namespace Yavsc.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
// GET: /Account/ConfirmEmail
|
|
|
|
// GET: /Account/ConfirmEmail
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public async Task<IActionResult> ConfirmEmail(string userId, string code)
|
|
|
|
public async Task<IActionResult> ConfirmEmail(string userId, string code)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (userId == null || code == null)
|
|
|
|
if (userId == null || code == null)
|
|
|
|
@ -342,6 +356,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/ForgotPassword
|
|
|
|
// GET: /Account/ForgotPassword
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public IActionResult ForgotPassword()
|
|
|
|
public IActionResult ForgotPassword()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return View();
|
|
|
|
return View();
|
|
|
|
@ -350,6 +365,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// POST: /Account/ForgotPassword
|
|
|
|
// POST: /Account/ForgotPassword
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
public async Task<IActionResult> ForgotPassword(ForgotPasswordViewModel model)
|
|
|
|
public async Task<IActionResult> ForgotPassword(ForgotPasswordViewModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -382,6 +398,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/ForgotPasswordConfirmation
|
|
|
|
// GET: /Account/ForgotPasswordConfirmation
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public IActionResult ForgotPasswordConfirmation()
|
|
|
|
public IActionResult ForgotPasswordConfirmation()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return View();
|
|
|
|
return View();
|
|
|
|
@ -390,6 +407,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/ResetPassword
|
|
|
|
// GET: /Account/ResetPassword
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public IActionResult ResetPassword(string UserId, string code = null)
|
|
|
|
public IActionResult ResetPassword(string UserId, string code = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return code == null ? View("Error") : View();
|
|
|
|
return code == null ? View("Error") : View();
|
|
|
|
@ -398,6 +416,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// POST: /Account/ResetPassword
|
|
|
|
// POST: /Account/ResetPassword
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
public async Task<IActionResult> ResetPassword(ResetPasswordViewModel model)
|
|
|
|
public async Task<IActionResult> ResetPassword(ResetPasswordViewModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -423,6 +442,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/ResetPasswordConfirmation
|
|
|
|
// GET: /Account/ResetPasswordConfirmation
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public IActionResult ResetPasswordConfirmation()
|
|
|
|
public IActionResult ResetPasswordConfirmation()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return View();
|
|
|
|
return View();
|
|
|
|
@ -489,6 +509,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// GET: /Account/VerifyCode
|
|
|
|
// GET: /Account/VerifyCode
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
public async Task<IActionResult> VerifyCode(string provider, bool rememberMe, string returnUrl = null)
|
|
|
|
public async Task<IActionResult> VerifyCode(string provider, bool rememberMe, string returnUrl = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Require that the user has already logged in via username/password or external login
|
|
|
|
// Require that the user has already logged in via username/password or external login
|
|
|
|
@ -503,6 +524,7 @@ namespace Yavsc.Controllers
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// POST: /Account/VerifyCode
|
|
|
|
// POST: /Account/VerifyCode
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
[ValidateAntiForgeryToken]
|
|
|
|
public async Task<IActionResult> VerifyCode(VerifyCodeViewModel model)
|
|
|
|
public async Task<IActionResult> VerifyCode(VerifyCodeViewModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|