I have a users page that contains a table of users. In that page I have a form that creates users. When submit button of that form is clicked Register Action is called in AccountController. And register action redirects to users page again to show all users with newly added user.
The problem is that; although i dont make the user log in, browser asks me to remember the password for the user i have created. I dont want it show me that remember password popup
Here is my Register Action
[HttpPost]
public ActionResult Register(User user, int page)
{
if (ModelState.IsValid)
{
if (user.Id == 0)
{
user.Password = HashPassword(user.Password);
context.Users.Add(user);
//context.Entry(user.Role).State = System.Data.Entity.EntityState.Unchanged;
context.SaveChanges();
}
else
{
//user.Email = (from dbUser in context.Users where dbUser.Id == user.Id select dbUser.Email).FirstOrDefault();
user.Password = HashPassword(user.Password);
context.Entry(user).State = System.Data.Entity.EntityState.Modified;
context.SaveChanges();
}
}
if (page == 0)
{
return RedirectToAction("Users", "Dashboard");
}
else
{
return RedirectToAction("Users", "Dashboard", new { page });
}
}
This is Users Action of my DashboardController
[Authorize(Roles = "Admin")]
public ActionResult Users(int page = 1)
{
ViewBag.Users = (from user in context.Users join company in context.Companies on user.CompanyID equals company.ID into joined from j in joined.DefaultIfEmpty() select user).OrderBy(a => a.Id).ToPagedList(page, 15);
List<Role> vRoles = (from role in context.Roles select role).ToList();
ViewBag.Roles = new SelectList(vRoles, "ID", "Authority");
List<Company> vCompanies = (from company in context.Companies select company).ToList();
ViewBag.Companies = new SelectList(vCompanies, "ID", "CompanyName");
return View();
}
My users page is restricted to Access via Authorize annotation