You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
using System;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using Microsoft.AspNet.Identity;
|
|
using Microsoft.AspNet.Identity.Owin;
|
|
using Owin;
|
|
using WebFormApp.Models;
|
|
|
|
namespace WebFormApp.Account
|
|
{
|
|
public partial class ResetPassword : Page
|
|
{
|
|
protected string StatusMessage
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
protected void Reset_Click(object sender, EventArgs e)
|
|
{
|
|
string code = IdentityHelper.GetCodeFromRequest(Request);
|
|
if (code != null)
|
|
{
|
|
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
|
|
|
|
var user = manager.FindByName(Email.Text);
|
|
if (user == null)
|
|
{
|
|
ErrorMessage.Text = "Es wurde kein Benutzer gefunden.";
|
|
return;
|
|
}
|
|
var result = manager.ResetPassword(user.Id, code, Password.Text);
|
|
if (result.Succeeded)
|
|
{
|
|
Response.Redirect("~/Account/ResetPasswordConfirmation");
|
|
return;
|
|
}
|
|
ErrorMessage.Text = result.Errors.FirstOrDefault();
|
|
return;
|
|
}
|
|
|
|
ErrorMessage.Text = "Fehler";
|
|
}
|
|
}
|
|
} |