Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public ActionResult Login(LoginModel model, string returnUrl)
- {
- // if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
- // {
- // return RedirectToLocal(returnUrl);
- // }
- // If we got this far, something failed, redisplay form
- string query = @"
- SELECT [Id]
- ,[FirstName]
- ,[LastName]
- ,[MiddleName]
- ,[FullName]
- ,[Usercol]
- ,[Title]
- ,[PersonalEmailAddress]
- ,[OfficialEmailAddress]
- ,[JobTitle]
- ,[HomePhone]
- ,[MobilePhone]
- ,[OfficePhone]
- ,[PhotoUrl]
- ,[UTCConversionTimeZoneCode]
- ,[APIToken]
- ,[Country]
- ,[UserName]
- ,[Password]
- ,[CRMUserId]
- FROM User WHERE UserName = @UserName AND Password = @Password
- ";
- UserModels UserModel = null;
- using (IDbConnection db = new MySqlConnection(ConfigurationManager.ConnectionStrings["CRMPORTALSQLCONN"].ConnectionString))
- {
- UserModel = (UserModels)db.Query<UserModels>(query, new
- {
- @UserName = model.UserName,
- @Password = model.Password
- }).FirstOrDefault();
- }
- ModelState.AddModelError("", "The user name or password provided is incorrect.");
- return View(model);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement