having to change password from authenticated access
This commit is contained in:
@ -430,8 +430,13 @@ namespace Yavsc.Controllers
|
|||||||
// GET: /Account/ForgotPassword
|
// GET: /Account/ForgotPassword
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult ForgotPassword()
|
public async Task<IActionResult> ForgotPassword()
|
||||||
{
|
{
|
||||||
|
if (User.Identity.IsAuthenticated)
|
||||||
|
ViewBag.UserEmail = ( await _dbContext.Users.SingleAsync(
|
||||||
|
u => u.Id == User.GetUserId()
|
||||||
|
) ).Email;
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">@SR["LoginOrEmail"]</label>
|
<label class="col-md-2 control-label">@SR["LoginOrEmail"]</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input asp-for="LoginOrEmail" class="form-control" />
|
@if (User.Identity.IsAuthenticated) {
|
||||||
|
<input type="hidden" name="LoginOrEmail" value="@ViewBag.UserEmail" />
|
||||||
|
@ViewBag.UserEmail
|
||||||
|
|
||||||
|
} else {
|
||||||
|
<input asp-for="LoginOrEmail" class="form-control" />
|
||||||
|
}
|
||||||
<span asp-validation-for="LoginOrEmail" class="text-danger"></span>
|
<span asp-validation-for="LoginOrEmail" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-2 col-md-10">
|
<div class="col-md-offset-2 col-md-10">
|
||||||
<button type="submit" class="btn btn-default">Change password</button>
|
<button type="submit" class="btn btn-default">@SR["Change password"]</button>
|
||||||
|
|
||||||
|
<a asp-action="ForgotPassword" asp-controller="Account">@SR["Forgot your password?"]</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user