コード例 #1
0
        private int ChangePassword()
        {
            CustomerLogin loginCustomer = new CustomerLogin();

            loginCustomer.email      = email;
            loginCustomer.Password   = OldPassEntry.Text;
            loginCustomer.clientId   = Constants.ClientId;
            loginCustomer.ClientTime = DateTime.Now;

            LoginController loginController = new LoginController();

            cutomerAuthContext = loginController.CheckLogin(loginCustomer, token);

            if (cutomerAuthContext != null)
            {
                if (cutomerAuthContext.CustomerId > 0)
                {
                    CustomerController customoerController = new CustomerController();
                    CPId = customoerController.changePassword(cutomerAuthContext.CustomerId, OldPassEntry.Text, newPassEntry.Text, token);
                }
                else
                {
                    CPId = -1;
                }
            }
            else
            {
                CPId = -1;
            }
            return(CPId);
        }
コード例 #2
0
        public async Task <IActionResult> PutCustomerLogin(decimal?id, CustomerLogin customerLogin)
        {
            if (id != customerLogin.CusId)
            {
                return(BadRequest());
            }

            _context.Entry(customerLogin).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerLoginExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public Object MobMatchOTP([FromBody] CustomerLogin Login)
        {
            var json        = (object)null;
            int MobileExist = 0;

            try
            {
                cnn.Close();
                string     query1   = "select Top 1 OTP from OTPVerification where MobileNo='" + Login.MobileNo + "' order by Id desc";
                SqlCommand cmdExist = new SqlCommand(query1, cnn);
                cnn.Open();
                SqlDataReader drExist = cmdExist.ExecuteReader();
                if (drExist.Read())
                {
                    MobileExist = Convert.ToInt32(drExist[0].ToString());
                }
                cnn.Close();
                json = "OTP is " + MobileExist;
            }
            catch (Exception ec)
            {
                json = "User not found";
            }

            return(json);
        }
コード例 #4
0
        public ActionResult LoginCustomer(string txtEmail, string txtPassWord)
        {
            CustomerAccountDAO customerAccountDAO = new CustomerAccountDAO();
            var result = customerAccountDAO.CheckLogin(txtEmail, Encryptor.MD5Hash(txtPassWord));

            if (result == 1)
            {
                var customer        = customerAccountDAO.getCustomerAccount(txtEmail);
                var customersession = new CustomerLogin();
                customersession.Email    = customer.Email;
                customersession.PassWord = customer.PassWord;
                customersession.Name     = customer.Name;
                Session.Add(Common.CommonConstants.Customer_SESSION, customersession);
                return(Redirect("/"));
            }
            else if (result == 0)
            {
                TempData["msg"] = "<script>alert('tên đăng nhập không tồn tại!')</script>";
            }
            else if (result == -1)
            {
                //ModelState.AddModelError("", "Bạn đã điền sai password");

                TempData["msg"] = "<script>alert('bạn đã điền sai mật khẩu!')</script>";
            }
            return(Redirect("/"));
        }
コード例 #5
0
 public ActionResult Login(CustomerLogin customer)
 {
     ModelState.Remove("FirstName");
     ModelState.Remove("LastName");
     ModelState.Remove("Email");
     ModelState.Remove("ConfirmPassword");
     if (ModelState.IsValid)
     {
         customer.Username    = dao.CheckLogin(customer);
         ViewData["Username"] = customer.Username;
         if (customer.Username != null)
         {
             Session["name"]     = customer.Username;
             ViewData["message"] = "User logged in succesfully";
             ModelState.Clear();
         }
         else if (string.IsNullOrEmpty(dao.message))
         {
             ViewData["message"] = "User cannot be found";
         }
         else
         {
             ViewData["message"] = "Error " + dao.message;
         }
     }
     return(View());
 }
コード例 #6
0
        public ActionResult Login(FormCollection form, bool rememberMe = false)
        {
            String        username      = form["Username"].ToString();
            String        password      = form["Password"].ToString();
            CustomerLogin customerLogin = db.CustomerLogins.Find(username);

            var currentCustomerUser = db.Database.SqlQuery <CustomerLogin>(
                "Select * " +
                "FROM CustomerLogin " +
                "WHERE CustUserName = '******' AND " +
                "CustPassword = '******'");

            var currentEmployeeUser = db.Database.SqlQuery <EmployeeLogin>(
                "Select * " +
                "FROM EmployeeLogin " +
                "WHERE EmpUserName = '******' AND " +
                "EmpPassword = '******'");

            if (currentCustomerUser.Count() > 0)
            {
                var id = customerLogin.CustID;
                ViewBag.ClientID = id;
                FormsAuthentication.SetAuthCookie(username, rememberMe);
                return(RedirectToAction("Index", "Home", new { userlogin = username }));
            }
            else if (currentEmployeeUser.Count() > 0)
            {
                FormsAuthentication.SetAuthCookie(username, rememberMe);
                return(RedirectToAction("EmployeeIndex", "Home", new { userlogin = username }));
            }
            {
                return(View());
            }
        }
コード例 #7
0
        public ActionResult CheckAuthenticate(CustomerLogin customerLogin)
        {
            var result = apiCaller.Call <LoginRequest, LoginResponse>(Model.Web.DashboardAPIControllers.Authentication, "Login", HttpMethod.Post, new LoginRequest()
            {
                Email    = customerLogin.Email,
                Password = customerLogin.Password
            });

            if (result.Status == Model.ResponseStatus.Success)
            {
                return(RedirectToAction("Home", "Home", new { area = "" }));
            }
            else
            {
                CustomerLogin customerLoginResponse = new CustomerLogin();
                customerLoginResponse.Status = result.Status;
                if (result.EndUserMessage != null)
                {
                    customerLoginResponse.EndUserMessage = result.EndUserMessage;
                }
                else
                {
                    customerLoginResponse.EndUserMessage = "Api Connection Problem!";
                }
                return(View("Login", customerLoginResponse));
            }
        }
コード例 #8
0
        public ActionResult Register(CustomerLogin collection)
        {
            try
            {
                // TODO: Add insert logic here
                List <object> newRecord = new List <object>();
                newRecord.Add(collection.CustomerID);
                newRecord.Add(collection.Password);


                object[] recordItems = newRecord.ToArray();
                int      result      = db.Database.ExecuteSqlCommand("INSERT INTO CUSTOMERLOGINTABLE " +
                                                                     "(CustomerID, Password) " +
                                                                     "VALUES (@p0, @p1)", recordItems);

                if (result > 0)
                {
                    ViewBag.msg = "Account have been created";
                }
                return(View());
            }
            catch
            {
                return(View());
            }
        }
コード例 #9
0
 public ActionResult LoginIntoSystem(CustomerLogin data)
 {
     if (ModelState.IsValid)
     {
         TestDatabaseEntities ent = new TestDatabaseEntities();
         var encryptedPassword    = StringCipher.Encrypt(data.Password);
         var customer             = ent.Customers.FirstOrDefault(t => (t.Login.ToUpper() == data.Login && t.Password == encryptedPassword));
         var roles = ent.CustomerRoles.Where(t => (t.Customers.Login.ToUpper() == data.Login && t.Customers.Password == encryptedPassword && t.Role.Name != "Customer"));
         if (customer == null)
         {
             ViewBag.ErrorMessage = "Unfortunately the user is not found!";
             return(View("Login"));
         }
         else if (customer.IsDisabled == true)
         {
             ViewBag.ErrorMessage = "Unfortunately the user is locked!";
             return(View("Login"));
         }
         else if (roles == null)
         {
             ViewBag.ErrorMessage = "Unfortunately the user is not authorized to enter!";
             return(View("Login"));
         }
         else
         {
             return(Redirect("/Home/Customers"));
         }
     }
     else
     {
         ViewBag.ErrorMessage = "Unfortunately some of the fields are not filled!";
         return(View("Login"));
     }
 }
コード例 #10
0
        public ActionResult Login(string username, string password)
        {
            try
            {
                CustomerLogin temp = db.CustomerLogin.SingleOrDefault(m => m.Username == username && m.Password == password);

                if (temp == null)
                {
                    Exception e = new Exception("Incorrect user access.");
                    return(View("Error", new HandleErrorInfo(e, "Home", "Login")));
                }
                else
                {
                    GlobalClass.UserDetail = temp;
                    CustomerContact obj = db.CustomerContact.Find(temp.ContactKey);

                    Customer customer = db.Customer.Find(temp.CustomerKey);
                    GlobalClass.CustomerDetail = customer;

                    GlobalClass.LoginUser = obj;

                    GlobalClass.Company = db.Company.SingleOrDefault(m => m.CompanyKey == obj.CompanyKey);

                    GlobalClass.SystemSession = true;
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (DivideByZeroException e)
            {
                return(View("Error", new HandleErrorInfo(e, "Home", "Login")));
            }
        }
コード例 #11
0
        public async Task StoreCustomerLogin(string customerId, string accessToken, string refreshToken, RefreshTokenDto oldToken = null)
        {
            if (oldToken.IsNotEmpty())
            {
                var existingCustomerLogin = _dbContext.CustomerLogins.FirstOrDefault(x =>
                                                                                     x.AccessToken == oldToken.AccessToken &&
                                                                                     x.RefreshToken == oldToken.RefreshToken &&
                                                                                     x.CustomerId == oldToken.UserId
                                                                                     );
                if (existingCustomerLogin.IsNotEmpty())
                {
                    existingCustomerLogin.AccessToken  = accessToken;
                    existingCustomerLogin.RefreshToken = refreshToken;
                    existingCustomerLogin.UpdateAt     = DateTime.Now;
                    _dbContext.CustomerLogins.Update(existingCustomerLogin);
                    await _dbContext.SaveChangesAsync();
                }
            }
            else
            {
                var customerLogin = new CustomerLogin
                {
                    CustomerId   = customerId,
                    AccessToken  = accessToken,
                    RefreshToken = refreshToken
                };
                await _dbContext.CustomerLogins.AddAsync(customerLogin);

                await _dbContext.SaveChangesAsync();
            }
        }
コード例 #12
0
 public ActionResult Login(CustomerLogin login)
 {
     if (ModelState.IsValid)
     {
         try
         {
             int custId = CustomerDB.CustomerLogin(login);
             if (custId == -1)
             {
                 ModelState.AddModelError("", "Username or password does not match");
                 return(View(login));
             }
             else
             {
                 Session["CustomerId"] = custId;
                 return(RedirectToAction("Index"));
             }
         }
         catch
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }
コード例 #13
0
        //reset the password
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            CustomerLogin reset = new CustomerLogin();

            string oldPwd     = txtOldPassword.Text;
            string newPwd     = txtNewPassword.Text;
            string confirmPwd = txtConfirmPwd.Text;

            if (!CustomerDB.CheckPassword((int)Session["CustomerId"], oldPwd))
            {
                lblResetError.Text = "Current password incorrect. Please try again.";
            }
            else // do reset
            {
                reset.CustomerId = (int)Session["CustomerId"];
                reset.Password   = newPwd;
                try
                {
                    if (CustomerDB.ResetCustomerPassword(reset))
                    {
                        lblResetError.Text = "Reset successfully.";
                    }
                }
                catch (Exception ex)
                {
                    lblResetError.Text = ex.Message;
                }
            }
        }
コード例 #14
0
        public ActionResult SignUp(UserRegisterView regUser)
        {
            using (GerGarageDbEntities db = new GerGarageDbEntities())
            {
                CustomerRegistry user = new CustomerRegistry();

                user.CustomerFirstName  = regUser.CustomerFirstName;
                user.CustomerLastName   = regUser.CustomerLastName;
                user.CustomerContact    = regUser.CustomerContact;
                user.CustomerEmailId    = regUser.CustomerEmailId;
                user.CustomerPassword   = regUser.CustomerPassword;
                user.CustomerAddress    = regUser.CustomerAddress;
                user.CustomerPostalCode = regUser.CustomerPostalCode;

                CustomerLogin logUser = new CustomerLogin();
                logUser.CustomerEmailId  = regUser.CustomerEmailId;
                logUser.CustomerPassword = regUser.CustomerPassword;
                if (ModelState.IsValid)
                {
                    db.CustomerRegistries.Add(user);
                    db.CustomerLogins.Add(logUser);
                    db.SaveChanges();

                    return(RedirectToAction("Login"));
                }
                return(View());
            }
        }
コード例 #15
0
        public IActionResult AuthenticateCustomer([FromBody] CustomerLogin customer)
        {
            CustomerLogin customer1 = _repository.FindCustomer(customer);

            if (customer1 != null)
            {
                if (customer1.CustomerUsername != customer.CustomerUsername && customer1.CustomerPassword != customer1.CustomerPassword)
                {
                    return(Unauthorized());
                }
                else
                {
                    var token = jWTAuthenticationManager.Authenticate(customer.CustomerUsername, customer.CustomerPassword);
                    if (token == null)
                    {
                        return(Unauthorized());
                    }
                    return(Ok(token));
                }
            }
            else
            {
                return(Unauthorized());
            }
        }
コード例 #16
0
        public ActionResult Index(CustomerLogin login)
        {
            try
            {
                // Create a new list to store details of new login
                List <object> newLogin = new List <object>();
                newLogin.Add(login.CustomerID);
                newLogin.Add(login.Password);

                // Copy login items into an array for easy addition into SQL statement
                object[] loginItems = newLogin.ToArray();
                var      data       = db.CUSTOMERLOGINTABLE.SqlQuery("SELECT * FROM CUSTOMERLOGINTABLE WHERE CustomerID=@p0 AND Password=@p1", loginItems).SingleOrDefault();

                // If login successful
                if (data != null)
                {
                    Session["CustomerID"] = login.CustomerID.ToString(); //set session
                    return(RedirectToAction("List"));
                }
                else
                {
                    ViewBag.msg = "Customer ID and/or Password is invalid";
                    return(View());
                }
            }
            catch
            {
                return(View());
            }
        }
コード例 #17
0
        public ActionResult LoginCustomer(string txtEmail, string txtPassWord)
        {
            CustomerAccountDAO customerAccountDAO = new CustomerAccountDAO();
            var result = customerAccountDAO.CheckLogin(txtEmail, Encryptor.MD5Hash(txtPassWord));

            if (result == 1)
            {
                var customer        = customerAccountDAO.getCustomerAccount(txtEmail);
                var customersession = new CustomerLogin();
                customersession.Email    = customer.Email;
                customersession.PassWord = customer.PassWord;
                customersession.Name     = customer.Name;
                Session.Add(Common.CommonConstants.Customer_SESSION, customersession);
                return(Redirect("/"));
            }
            else if (result == 0)
            {
                TempData["msg"] = MessageBox.Show("Tài Khoản Không Tồn Tại");
            }
            else if (result == -1)
            {
                ModelState.AddModelError("", "Bạn đã điền sai password");
            }
            return(View());
        }
コード例 #18
0
        public CutomerAuthContext CheckLogin(CustomerLogin loginCustomer, string token)
        {
            CutomerAuthContext authContext = new CutomerAuthContext();

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "Registration/RegistrationLogin");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(loginCustomer);
                    var buffer      = Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        authContext = JsonConvert.DeserializeObject <CutomerAuthContext>(responseStream);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(authContext);
        }
コード例 #19
0
        public ActionResult CustomerLogin(CustomerLogin cslogin, string ReturnUrl)
        {
            System.Diagnostics.Debug.WriteLine("in Login Action");
            string message = "";

            using (EWorkDatabaseEntities dc = new EWorkDatabaseEntities()) {
                var v = dc.Customers.Where(a => a.EmailID == cslogin.EmailID).FirstOrDefault();

                System.Diagnostics.Debug.WriteLine("Here is your query message" + v);

                if (v != null)
                {
                    System.Diagnostics.Debug.WriteLine("Compare..." + string.Compare(Crypto.Hash(cslogin.Password), v.Password));


                    System.Diagnostics.Debug.WriteLine("URL..." + ReturnUrl);



                    if (string.Compare(Crypto.Hash(cslogin.Password), v.Password) == 0)
                    {
                        System.Diagnostics.Debug.WriteLine("Success Login Message..............");
                        int    timeout   = cslogin.RememberMe ? 525600 : 20;//525600mint=1year
                        var    ticket    = new FormsAuthenticationTicket(cslogin.EmailID, cslogin.RememberMe, timeout);
                        string encrypted = FormsAuthentication.Encrypt(ticket);
                        var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                        cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                        cookie.HttpOnly = true;
                        Response.Cookies.Add(cookie);
                        Session["UserID"]    = v.Cust_Id.ToString();
                        Session["FirstName"] = v.FirstName.ToString();
                        Session["LastName"]  = v.LastName.ToString();



                        if (Url.IsLocalUrl(ReturnUrl))
                        {
                            return(Redirect(ReturnUrl));
                        }
                        else
                        {
                            return(RedirectToAction("Pro_Index", "Professional"));
                        }
                    }
                    else
                    {
                        message = "Invalid Information";
                    }
                }
                else
                {
                    message = "Invalid Information";
                }
            }

            ViewBag.Message = message;
            return(View());
        }
コード例 #20
0
        public ActionResult RegisterCredentials()
        {
            ICustManager  ic = new CustomerManager();
            CustomerLogin ca = new CustomerLogin
            {
                UID = ic.GenerateID(ENType.Login),
            };

            return(View(ca));
        }
コード例 #21
0
        public ActionResult Auth(CustomerLogin model)
        {
            if (ModelState.IsValid)
            {
                Customer customer = null;
                using (DominosContext db = new DominosContext())
                {
                    customer = db.Customers.FirstOrDefault(u => u.CustomerEmail == model.CustomerEmail && u.CustomerPassword == model.CustomerPassword);
                }


                if (customer != null)
                {
                    FormsAuthentication.SetAuthCookie(model.CustomerEmail, true);

                    switch (customer.CustomerRoleId)
                    {
                    case 1:
                    {
                        Session["user"] = customer;
                        if ((Cart)Session["cart"] != null)
                        {
                            return(RedirectToAction("Cart", "Home"));
                        }
                        else
                        {
                            return(RedirectToAction("Index", "Home"));
                        } break;
                    }

                    case 2:
                        return(RedirectToAction("Manage", "Crmpanel")); break;

                    case 3:
                        return(RedirectToAction("Manager", "Crmpanel")); break;

                    case 4:
                        return(RedirectToAction("Kitchen", "Crmpanel")); break;

                    case 5:
                        return(RedirectToAction("Delivery", "Crmpanel")); break;

                    default:
                        return(RedirectToAction("Index", "Home"));

                        break;
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Пользователя с таким логином и паролем нет");
                }
            }
            return(View());
        }
コード例 #22
0
        public async Task <string> login(CustomerLogin customerLogin)
        {
            var customer = await _customerRepository.login(customerLogin);

            if (customer != null)
            {
                var token = _tokenService.generateToken(customer);

                return(token);
            }

            return(null);
        }
コード例 #23
0
        public static Customer CreateCustomer(Registration registration)
        {
            var timeCreated  = DateTime.Now;
            var mobileDevice = new MobileDevice()
            {
                DeviceId        = registration.DeviceId,
                LineNumber      = registration.PhoneNumber,
                NetworkOperator = registration.OperatorDeviceSim,
                SimCountryIso   = string.Empty,
                SimOperator     = registration.OperatorDeviceSim,
                SimSerialNumber = registration.SimSerialNumber,
                SubscriberId    = registration.SimSubscriberId
            };
            var person = new Person()
            {
                DateOfBirth = registration.Dob,
                DateCreated = timeCreated,
                Firstname   = registration.FirstName,
                Lastname    = registration.LastName,
            };

            PasswordHasher.GetNewPassword(registration.Pwd, false);
            var pwd           = PasswordHasher.HashPassword(registration.Pwd);
            var customerLogin = new CustomerLogin()
            {
                EmailAddress         = registration.Email,
                LoginStatusCode      = "Enabled",
                EmailAddressVerified = false,
                Number  = registration.PhoneNumber,
                Pwd     = pwd.Item1,
                PwdSalt = pwd.Item2,
            };

            List <MobileDevice> mobiles = new List <MobileDevice>();

            mobiles.Add(mobileDevice);

            var customer = new Customer()
            {
                Balance          = 0,
                CurrencyCode     = "XAF",
                CustomerTypeCode = "Standard",
                DateCreated      = timeCreated,
                MobileDevices    = new System.Collections.ObjectModel.ObservableCollection <MobileDevice>(mobiles),
                Person           = person,
                IdRegistration   = registration.IdRegistration,
                CustomerLogin    = customerLogin,
            };

            return(customer);
        }
コード例 #24
0
ファイル: Default.aspx.cs プロジェクト: skocode/Assignment5
 /// <summary>
 /// When the button is clicked, this code uses the CustomerLogin class to validate the entered user name and password. If they are valid, it redirects to Default2.aspx. If they are invalid, it will display an invalid login message.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button1_Click(object sender, EventArgs e)
 {
     CustomerLogin cl = new CustomerLogin();
     int pk = cl.Login(txtuser.Text, txtpassword.Text);
     if (pk != 0)
     {
         Session["person"] = pk;
         Response.Redirect("Default2.aspx");
     }
     else
     {
         lblmsg.Text = "Invalid Login";
     }
 }
コード例 #25
0
        public ActionResult Login(CustomerLogin login, string ReturnUrl = "")
        {
            string message = "";

            using (CMSEntities db = new CMSEntities())
            {
                var v = db.Customers.Where(a => a.Email == login.Email).FirstOrDefault();
                if (v != null)
                {
                    if (v.IsEmailVerified ?? false)

                    {
                        ViewBag.Message = "Please verify your email first";
                        return(View());
                    }

                    if (string.Compare(Crypto.Hash(login.Password), v.Password) == 0)
                    {
                        // 525600 min = 1 year
                        int    timeout   = login.RememberMe ? 525600 : 20;
                        var    ticket    = new FormsAuthenticationTicket(login.Email, login.RememberMe, timeout);
                        string encrypted = FormsAuthentication.Encrypt(ticket);
                        var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                        cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                        cookie.HttpOnly = true;
                        Response.Cookies.Add(cookie);


                        if (Url.IsLocalUrl(ReturnUrl))
                        {
                            return(Redirect(ReturnUrl));
                        }
                        else
                        {
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                    else
                    {
                        message = "Invalid credential provided";
                    }
                }
                else
                {
                    message = "Invalid credential provided";
                }
            }
            ViewBag.Message = message;
            return(View());
        }
コード例 #26
0
 public void UpdateCustomerPassword(string idCustomer, string newPassword)
 {
     try
     {
         CustomerLogin customerLogin = db.CustomerLogin.FirstOrDefault(x => x.IdCustomer == idCustomer);
         customerLogin.Password = newPassword;
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         throw;
     }
 }
コード例 #27
0
        public async Task <ActionResult <string> > Authenticate([FromBody] CustomerLogin customerLogin)
        {
            if (ModelState.IsValid)
            {
                var token = await _customerService.login(customerLogin);

                if (token != null)
                {
                    return(token);
                }
                return(NotFound(new { message = "Usuário ou senha inválidos" }));
            }

            return(this.StatusCode(500));
        }
コード例 #28
0
        public ActionResult LoginPass(CustomerLogin cl)
        {
            String    qry = "select * from Register where Email='" + cl.CustomerName + "' and Password='******'";
            DataTable tbl = new DataTable();

            tbl = srchRecord(qry);
            if (tbl.Rows.Count > 0)
            {
                return(View("CustomerDashboard"));
            }
            else
            {
                return(View("Invalid"));
            }
        }
コード例 #29
0
        public ActionResult LoginC(CustomerLogin log)
        {
            var testConnection = CustomerLoginManager.IsUserValid(log.Email, log.Password);

            if (testConnection != 0)
            {
                HttpContext.Session.SetInt32("idCustomer", testConnection);
                return(RedirectToAction("CreateOrder", "Order"));
            }
            else
            {
                ViewData["MessageError"] = "Email or Password incorrect, try again";
                return(View());
            }
        }
コード例 #30
0
        public bool ChangeCustLogin(CustomerLogin cl)
        {
            var c = uow.CustomerLoginRepositories.Find(cl);

            if (c != null)
            {
                uow.CustomerLoginRepositories.Edit(cl);
                uow.Save();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #31
0
        public ActionResult GetCustomerInfo(FormCollection form)
        {
            string        username = form["CustUserName"].ToString();
            CustomerLogin login    = db.CustomerLogins.Find(username);
            var           id       = login.CustID;

            ViewBag.ClientID = id;

            if (login == null)
            {
                ViewBag.ErrorMessage = "Incorrect Login";
                return(View());
            }

            return(View("GetQuote", db.Assays.ToList()));
        }
コード例 #32
0
ファイル: Default2.aspx.cs プロジェクト: skocode/FinalProject
    protected void LogInBtn_Click(object sender, EventArgs e)
    {
        //This code uses the CustomerLogin class to validate the entered log in information, retrieve the Person Key of the user who logged in, and save the key in the "person" session, then redirect to Default5.aspx
        try
        {
            CustomerLogin cl = new CustomerLogin();
            int pk = cl.Login(txtuser.Text, txtpassword.Text);
            if (pk != 0)
            {
                Session["person"] = pk;
                Response.Redirect("Default5.aspx", false);
            }
            else
            {
                lblmsg.Text = "Invalid Login";
            }
           }

        catch (Exception ex)
        {
            Session["error"] = ex.Message;
            Response.Redirect("Default6.aspx");
        }
    }