public ActionResult LogOn(LogOnModel model, string returnUrl) { LDAPConnection check = new LDAPConnection(); if (ModelState.IsValid) { // if (check.requestUser(model.UserName, model.Password)) // { model.UserName = "******"; model.Password = "******"; model.RememberMe = false; TARSUserDBContext TARSUserDB = new TARSUserDBContext(); // TARSUserDB.TARSUserList.Find(model.UserName); //check for and save any updates to the user's info in active directory CheckForActiveDirectoryChanges(model); FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } // } /* else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } */ } // If we got this far, something failed, redisplay form return View(model); }
public virtual ActionResult addUser(AddUserModel user) { Authentication auth = new Authentication(); if (auth.isAdmin(this) || Authentication.DEBUG_bypassAuth) { if (ModelState.IsValid) { LDAPConnection newConnection = new LDAPConnection(); List<string> userInfo = newConnection.create(user.UserName); //Code here for creating TARSUser object; this will require // changing the LDAPConnection.create function to only // return the user information that is pertinent to TARS /* var userEntry = new TARSUser(); userEntry.userName = userInfo[1]; TARSUserDB.TARSUserList.Add(userEntry); */ return RedirectToAction("userMaintanence"); } return View(user); } else { return View("error"); } }