I'm using ASP.NET MVC5 Identity and want users to be able to reset their password just by entering their email.
There is only a fixed number of users and they are already set up, including an email adress. If a user comes to the site, they may click the link "Send my Password" which should send the valid password to the depositted email.
I guess there is no easy way for the admin to receive the current password, so what I thought was necessary is to reset the password and then create the mail:
    [HttpPost]
    [AllowAnonymous]
    public JsonResult RecoverPassword(string usersEmail)
    {
        try
        {
            //"db" is my Context..
            var um = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(db));
            var user = db.Users.Where(x => x.Email == usersEmail).First();
            Random rnd = new Random();
            int rndNumber = rnd.Next(100, 999);
            string Password = "MostSecurePasswordInTheWorld" + rndNumber + ".";
            um.RemovePassword(user.Id);
            um.AddPassword(user.Id, Password);
            db.SaveChanges();
            //send mail
            ...
This might have some weaknesses (everybody who knows a valid email of some user might reset it, the password is sent in the mail, the auto-generated password is weak etc.). But the biggest weakness is .. the password just does not get reset.
I don't encounter any errors in debugging, though, and am kind of clueless. What might be the problem here? Is the "user" I'm getting from
var user = db.Users.Where(x => x.Email == usersEmail).First();
not the user-object needed here?