public ActionResult SubmitPropertiBekas(FormCollection formCollection) { if (System.Web.HttpContext.Current.Session[Variables._varEncryptedKey] == null) { return(SessionExpired()); } var formData = DecryptObject(formCollection[PAYLOAD]); // decrypt from js string randomKey = System.Web.HttpContext.Current.Session[Variables._varEncryptedKey].ToString(); string MaxSubmit = AESEncrytDecry.DecryptStringAES(randomKey, formData["MaxSubmit"]); PropertiBekas PropertiBekas = new PropertiBekas(); var culture = new System.Globalization.CultureInfo(SC.Context.Language.Name); var properties = PropertiBekas.GetType().GetProperties(); for (int i = 0; i < properties.Length; i++) { try { if (!string.IsNullOrWhiteSpace(AESEncrytDecry.DecryptStringAES(randomKey, formData[properties[i].Name]))) { properties[i].SetValue(PropertiBekas, Convert.ChangeType(AESEncrytDecry.DecryptStringAES(randomKey, formData[properties[i].Name]), properties[i].PropertyType, culture), null); } } catch { /* just continue ignore this error */ } } PropertiBekas.IDPROPERTIBEKAS = Guid.NewGuid(); PropertiBekas.CREATED = DateTime.Now; SubmitData(PropertiBekas, MaxSubmit); return(Json(new { success = true })); }
//[ValidateAntiForgeryToken] //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")] public ActionResult Login(LoginModel model, string returnUrl) { try { //WebSecurity.CurrentUserName // WebSecurity.CurrentUserId //ChannelFactory<IMembershipSrv> CF = new ChannelFactory<IMembershipSrv>("MEMBERSHIP"); //IMembershipSrv CSvc = (IMembershipSrv)CF.CreateChannel(); //SHARED.UserProfile userProfile = new SHARED.UserProfile(); //userProfile = CSvc.GetUserProfile(model.UserName); //CF.Close(); if (ModelState.IsValid && WebSecurity.Login(model.UserName, AESEncrytDecry.DecryptStringAES(model.Password), persistCookie: model.RememberMe)) { //ChannelFactory<ICommonSrv> CF = new ChannelFactory<ICommonSrv>("COMMON"); //ICommonSrv CSvc = (ICommonSrv)CF.CreateChannel(); BALCommon CSvc = new BALCommon(ConStr); try { UserMasters userMasters = CSvc.getUserProfile(model.UserName); //CF.Close(); if (!userMasters.ISACTIVE) { TempData["Msg"] = "Please Contact To Technical Team."; WebSecurity.Logout(); } else { if (model.FID > 0 && CSvc.InsertUpdateSession(model.UserName, model.FID) == 1) { return(RedirectToAction("Index", "Home")); } else { WebSecurity.Logout(); } } } catch (Exception ex) { WebSecurity.Logout(); ExecptionLogger.FileHandling("Account(UserLogin_getUserProfilePost)", "Error_014", ex, "Account"); } } else { TempData["Msg"] = "UserName and/or Password is incorrect."; } } catch (Exception ex) { WebSecurity.Logout(); ExecptionLogger.FileHandling("Account(UserLoginPost)", "Error_014", ex, "Account"); } //return View(model); return(RedirectToAction("Login")); }
public IActionResult OtpMatch(string enteredotp, string empid, string dob, string datafr) { int chkdata = 0; int chk = 0; if (empid.Trim().Length != 8) { empid = empid.Trim().ToString().PadLeft(8, '0'); } HttpContext.Session.SetString(Constant.EmployeeID, empid); try { string fromdata = ""; string tempdt = Convert.ToString(HttpContext.Session.GetString(Constant.DataFrom)); if (tempdt != null && tempdt != "") { fromdata = tempdt; } else { fromdata = datafr; } DateTime dt; DateTime.TryParseExact(dob, "dd-MM-yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt); string otndecrypt = AESEncrytDecry.DecryptStringAES(enteredotp.ToString()); HttpContext.Session.SetString(Constant.ValidUser, "invalid"); chk = _ILoginViewService.OTPmatch(Convert.ToInt32(otndecrypt), empid, dt, fromdata); if (chk == 0) { //new user HttpContext.Session.SetString(Constant.ValidUser, "valid"); chkdata = 1; } else if (chk == 2) { //generate otp chkdata = 2; TempData["flagfromotpMatch"] = 1; } else if (chk == 1) { chkdata = 0; } else if (chk == 4) { chkdata = 4; } } catch (Exception ex) { _logger.LogError(ex, ex.Message); ViewBag.Messages = new[] { new AlertModel("danger", "Warning!", "Entered Credentials Did Not Match") }; } return(Json(chkdata)); }
public ActionResult TraceTask(string genericId) { Guid genericId_Dycrypt = new Guid(AESEncrytDecry.DecryptStringAES(genericId)); string parentTableName = database.Automation_Generic.FirstOrDefault(q => q.ID == genericId_Dycrypt).Title; string parentTableHtml = DetectDetailView(genericId_Dycrypt, parentTableName); ViewData["parentTableHtml"] = parentTableHtml; return(View()); }
private void button1_Click(object sender, EventArgs e) { this.txtUsuarioInternetEnc.Text = AESEncrytDecry.Desencriptar(this.txtUsuarioInternetDes.Text); this.txtPasswordEnc.Text = AESEncrytDecry.Desencriptar(this.txtPasswordDes.Text); this.txtUsuarioFTPEnc.Text = AESEncrytDecry.Desencriptar(this.txtUsuarioFTPDes.Text); this.txtClaveUsuFTPEnc.Text = AESEncrytDecry.Desencriptar(this.txtClaveUsuFTPDes.Text); this.txtUsuarioInternetDes.Refresh(); this.txtClaveUsuFTPDes.Refresh(); this.txtUsuarioFTPDes.Refresh(); this.txtClaveUsuFTPDes.Refresh(); }
public IActionResult ApproverLogin(ApproverLogin loginViewModel) { if (!ModelState.IsValid) { return(View()); } try { var empid = ""; loginViewModel.Password = AESEncrytDecry.DecryptStringAES(loginViewModel.Password); var result = AdLogin(loginViewModel.UserId, loginViewModel.Password, loginViewModel.MailID, loginViewModel.Mobileno, out empid, out string userName, out string firstname); if (!result) { ViewBag.Messages = new[] { new AlertModel("danger", "Warning!", "Entered Credentials Did Not Match") }; return(View()); } else { var EmpID = loginViewModel.UserId; var employeeid = empid; if (employeeid.Length != 8) { employeeid = employeeid.ToString().PadLeft(8, '0'); } Tuple <string, int> Result = _Ileaveapprovalservice.InsertEmpId(employeeid); if (Result.Item2 == 0) { TempData["loginendtime"] = Result.Item1; return(RedirectToAction("LoginTimeout", "Home")); } HttpContext.Session.SetString(Constant.ApproverID, employeeid); HttpContext.Session.SetString(Constant.AdminID, employeeid); HttpContext.Session.SetString(Constant.SessionUserName, userName); HttpContext.Session.SetString(Constant.SessionModulName, "Approver"); HttpContext.Session.SetString("FirstName", firstname); ViewBag.UserName = HttpContext.Session.GetString(Constant.SessionUserName); LeaveApprovalModelViewModel approverLogin = new LeaveApprovalModelViewModel(); string ModuleName = HttpContext.Session.GetString(Constant.SessionModulName); var MenuItem = _imenuservice.GetMenu(ModuleName, employeeid); MenuviewModel model = new MenuviewModel(); model.MenuModels = Mapper.Map <List <MenuModel> >(MenuItem); HttpContext.Session.SetObjectAsJson <MenuviewModel>(Constant.Menu, model); return(RedirectToAction("ApproverDashboard", "LeaveApprover")); } } catch (Exception ex) { _logger.LogError(ex, ex.Message); ViewBag.Messages = new[] { new AlertModel("danger", "Warning!", "Entered Credentials Did Not Match") }; return(View()); } }
public JsonResult GetCreditCard(long id) { try { var credit = _creditcardService.Find(c => c.CreditCardId == id); if (credit != null) { return(Json(new { status = true, data = new { CreditNumber = AESEncrytDecry.DecryptStringAES(credit.CreditNumber).Substring(12, 4), credit.Expire, credit.CVC } }, JsonRequestBehavior.AllowGet)); } } catch (Exception) { } return(Json(new { status = false }, JsonRequestBehavior.AllowGet)); }
private static Dictionary <string, string> DecryptObject(string Obj) { Obj = string.Concat(Obj.Reverse()); string key = Obj.Substring(0, 8) + Obj.Substring(Obj.Length - 8); string value = string.Concat(Obj.Reverse().Skip(8).Reverse()).Remove(0, 8); var result = AESEncrytDecry.DecryptStringAESJson(key, value); Dictionary <string, object> resultDict = new JavaScriptSerializer().DeserializeObject(result) as Dictionary <string, object>; Dictionary <string, string> results = new Dictionary <string, string>(); foreach (var item in resultDict) { results.Add(item.Key, item.Value.ToString()); } return(results); }
public ActionResult SubmitReedemPoint(FormCollection formCollection) { if (System.Web.HttpContext.Current.Session[Variables._varEncryptedKey] == null) { return(SessionExpired()); } var formData = DecryptObject(formCollection[PAYLOAD]); // decrypt from js string randomKey = System.Web.HttpContext.Current.Session[Variables._varEncryptedKey].ToString(); string itemId = AESEncrytDecry.DecryptStringAES(randomKey, formData["itemId"]); string name = AESEncrytDecry.DecryptStringAES(randomKey, formData["name"]); string creditcard = AESEncrytDecry.DecryptStringAES(randomKey, formData["creditcard"]); string mobilenumber = AESEncrytDecry.DecryptStringAES(randomKey, formData["mobilenumber"]); string email = AESEncrytDecry.DecryptStringAES(randomKey, formData["email"]); int maxsubmit = Convert.ToInt32(AESEncrytDecry.DecryptStringAES(randomKey, formData["maxsubmit"])); RedeemPoint entity = new RedeemPoint(); var culture = new System.Globalization.CultureInfo(SC.Context.Language.Name); var properties = entity.GetType().GetProperties(); for (int i = 0; i < properties.Length; i++) { try { if (!string.IsNullOrWhiteSpace(AESEncrytDecry.DecryptStringAES(randomKey, formData[properties[i].Name]))) { properties[i].SetValue(entity, Convert.ChangeType(AESEncrytDecry.DecryptStringAES(randomKey, formData[properties[i].Name]), properties[i].PropertyType, culture), null); } } catch { /* just continue ignore this error */ } } entity.ID = Guid.NewGuid(); entity.ItemId = itemId; entity.ItemName = Repository.GetItemName(itemId); entity.Fullname = name; entity.CreditCardNumber = creditcard; entity.MobileNumber = mobilenumber; entity.Email = email; entity.SubmitedDate = DateTime.Now; bool result = Repository.SubmitData(entity, maxsubmit); return(Json(result, JsonRequestBehavior.AllowGet)); }
private bool IsCpmplexPassword() { Regex obj = new Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,10}"); string complexValue = hdnComp.Value; var mixedPassword = AESEncrytDecry.DecryptStringAES(complexValue); string[] validValue = mixedPassword.Split('#'); if (!obj.IsMatch(validValue[0])) { lblMessageDisplay.Text = "Password must contain: Minimum 8 and Maximum 10 characters atleast 1 UpperCase Alphabet, 1 LowerCase Alphabet, 1 Number and 1 Special Character"; return(false); } else { return(true); } }
public JsonResult GetOTP(string UID) { BALCommon obj = new BALCommon(ConStr); bool res = false; string message = ""; try { string OTP = Utility.GetRendomString(6, "N"); res = obj.SetOTP(UID, OTP); #region SendMail if (res) { BALCommon CSvc = new BALCommon(ConStr); UserMasters userMasters = CSvc.getUserProfile(UID); MailDetails _MailDetails = new MailDetails(); _MailDetails.ToMailIDs = userMasters.EMAILID; _MailDetails.HTMLBody = true; _MailDetails.Subject = "Reset OTP"; _MailDetails.Body = BALMail.TemplateResetOTP(userMasters, AESEncrytDecry.EncryptStringAES(OTP)); if (BALMail.SendMail(_MailDetails)) { message = "OTP has been sent to your registered mail id."; } else { message = "Please contact technical team"; } } else { message = "Please contact technical team"; } #endregion SendMail } catch (Exception ex) { res = false; } return(Json(message, JsonRequestBehavior.AllowGet)); }
public ActionResult TraceTask_Async(string genericId) { Guid genericId_Dycrypt = new Guid(AESEncrytDecry.DecryptStringAES(genericId)); //اسم جدولی که باید در هدر صفحه نمایش داده شود(جدول پرنت) //رو داریم در میارم //و بعد میدیمش به تابع دیتکت ویو //و اون تابع اچ تی ام ال رو میسازه و تحویل ما میده var list = from p in database.Automation_Tasks.Where(q => q.genericId == genericId_Dycrypt) join u in database.USERS on p.Responsible equals u.User_Id select new { p.Title, p.IsActive, p.IsDone, p.Description, u.LFName, u.Username }; return(new ContentResult { Content = JsonConvert.SerializeObject(list), ContentType = "application/json", ContentEncoding = Encoding.UTF8 }); }
protected void btnResetPassword_Click(object sender, EventArgs e) { string DecPassword = AESEncrytDecry.DecryptStringAES(HDPassword.Value); if (DecPassword == "keyError") { FailureText.Text = string.Format("<span class='sfError'>{0}</span>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!"; } UserInfo userOld = m.GetUserDetails(GetPortalID, hdnUserName.Value); string Password, PasswordSalt; PasswordHelper.EnforcePasswordSecurity(m.PasswordFormat, DecPassword, out Password, out PasswordSalt); UserInfo user = new UserInfo(userOld.UserID, Password, PasswordSalt, m.PasswordFormat); m.ChangePassword(user); FailureText.Text = string.Format("<p class='sfSuccess'>{0}</p>", "Password Changed Successfully."); divRecoverPasswordFrom.Visible = false; divSuccessReq.Visible = true; divSuccessReq.InnerHtml = "<a href='/login'>Go to login</a>"; UserManagementController.DeactivateRecoveryCode(userOld.UserName, GetPortalID); rfvConfirmPass.Visible = false; rfvPassword.Visible = false; cmpPassword.Visible = false; }
protected void btnLogin_Click(object sender, EventArgs e) { Application["LoggedInUsers"] = null; try { if (!IsLogedIn(txtUserName.Text.Trim())) { return; } MD5HASH.Encryptdata(txtPassword.Text); if (Session["CaptchaImageText"] != null) { string captchaString = Session["CaptchaImageText"].ToString(); string hiddenPassword = hdnPassword.Value; string mixedPassword = AESEncrytDecry.DecryptStringAES(hiddenPassword); string[] mixedValue = mixedPassword.Split('#'); string codeNumber = mixedValue[1]; hdnPassword.Value = mixedValue[0]; if (!captchaString.Equals(codeNumber)) { RemovedLoggedUser(); txtCaptcha.Text = ""; lblMessageDisplay.Text = "Code entered does not match, please try again !"; return; } else { DataSet ds = AuthoProvider.IsUserLocked(txtUserName.Text); // We are checking whether User is Locked from login or Not. (Zahir) if (ds.IsValid()) // If any unsuccessfull login entry is found then dataset will contain rows for that particular user. (Zahir) { DataRow dr = ds.Tables[0].Rows[0]; int idLocked = Convert.ToInt16(dr[DataBaseFields.IsLocked]); double totalSeconds = 0; double seconds = 900; if (idLocked > 0) // If IdLocked is 1 then User is not allowed to Login. (Zahir) { totalSeconds = (DateTime.Now - Convert.ToDateTime(dr[DataBaseFields.lock_time])).TotalSeconds; if (totalSeconds <= seconds) { RemovedLoggedUser(); lblMessageDisplay.Text = "Your Id is being Locked, Please try after " + Math.Round((seconds - totalSeconds) / 60) + " Mins...!"; return; } else { // If the lock Time is passed then the entries is deleted for that particular user. (Zahir) int n = AuthoProvider.DeleteLoginErrorInfo(txtUserName.Text); checkAuthentication(); // call the function for redirecting user after checking username and password. (Zahir) } } else { checkAuthentication(); } } else { checkAuthentication(); } } } else { lblMessageDisplay.Text = "Session has been expired Please refresh page"; RemovedLoggedUser(); } } catch (Exception ex) { RemovedLoggedUser(); LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType()); Response.RedirectPermanent("~/ErrorPage.aspx", false); } }
private void LoginUser() { MembershipController member = new MembershipController(); RoleController role = new RoleController(); SuspendedIPController objSuspendedIP = new SuspendedIPController(); //username = AESEncrytDecry.DecryptStringAES(HDusername.Value); password = AESEncrytDecry.DecryptStringAES(HDPassword.Value); if (password == "keyError") { FailureText.Text = string.Format("<span class='sfError'>{0}</span>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!"; } else { UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text); HttpContext.Current.Session[SessionKeys.IsLoginClick] = false; if (user.UserExists && user.IsApproved) { if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(password))) { if (PasswordHelper.ValidateUser(user.PasswordFormat, password, user.Password, user.PasswordSalt)) { SucessFullLogin(user); } else { if (Session[SessionKeys.LoginHitCount] == null) { Session[SessionKeys.LoginHitCount] = 1; } else { loginhit = Convert.ToInt32(Session[SessionKeys.LoginHitCount]); loginhit++; Session[SessionKeys.LoginHitCount] = loginhit; } FailureText.Text = string.Format("<span class='sfError'>{0}</span>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!"; CaptchaValue.Text = string.Empty; if (loginhit == 3) { Page.Response.Redirect(Page.Request.Url.ToString(), true); } if (loginhit > 3 && loginhit < 6) { InitializeCaptcha(); CaptchaValue.Text = string.Empty; } else if (loginhit >= 6) { objSuspendedIP.SaveSuspendedIP(ipAddress); SuspendedIPAddressException(); Session[SessionKeys.LoginHitCount] = 0; MultiView1.Visible = false; } } } } else { if (Session[SessionKeys.LoginHitCount] == null) { Session[SessionKeys.LoginHitCount] = 1; } else { loginhit = Convert.ToInt32(Session[SessionKeys.LoginHitCount]); loginhit++; Session[SessionKeys.LoginHitCount] = loginhit; } FailureText.Text = string.Format("<span class='sfError'>{0}</span>", GetSageMessage("UserLogin", "UserDoesnotExist")); CaptchaValue.Text = string.Empty; if (loginhit == 3) { Page.Response.Redirect(Page.Request.Url.ToString(), true); } if (loginhit > 3 && loginhit < 6) { InitializeCaptcha(); CaptchaValue.Text = string.Empty; } else if (loginhit >= 6) { objSuspendedIP.SaveSuspendedIP(ipAddress); SuspendedIPAddressException(); Session[SessionKeys.LoginHitCount] = 0; MultiView1.Visible = false; } } } }
public async System.Threading.Tasks.Task <JsonResult> AddCreditCard(string creditCard) { var message = ""; HashingData hashing = new HashingData(); var userSession = SessionHelper.GetSession(AppSettingConstant.LoginSessionCustomer) as UserSession; if (userSession != null) { var user = _userService.Find(u => u.Username == userSession.Username); if (user != null) { if (creditCard != null) { var card = JsonConvert.DeserializeObject <CreditCard>(creditCard); card.CreditNumber = hashing.Decode(card.CreditNumber); card.CreatedAt = DateTime.Now; card.Status = Status.Active; card.Expire = card.Expire.Remove(3, 2); card.CustomerId = user.CustomerId.Value; var added = await _creditcardService.AddAsync(card); if (added != null) { return(Json(new { status = true, card = new { CreditNumber = AESEncrytDecry.DecryptStringAES(added.CreditNumber).Substring(12, 4), added.CreditCardId, added.Expire } }, JsonRequestBehavior.AllowGet)); } } } } return(Json(new { status = false, message }, JsonRequestBehavior.AllowGet)); }
public JsonResult Payment(long id) { var message = ""; UserSession userSession = SessionHelper.GetSession(AppSettingConstant.LoginSessionCustomer) as UserSession; if (userSession != null) { var user = _userRepository.Find(u => u.Status.Equals(Status.Active) && u.Username.Equals(userSession.Username)); if (user != null) { var orderSession = SessionHelper.GetSession(AppSettingConstant.CheckOutSession) as Order; if (orderSession != null) { var card = user.Customer.CreditCards.FirstOrDefault(c => c.CreditCardId == id & c.Status == Status.Active); if (card != null) { var bankCredit = _bankService.CheckCard(AESEncrytDecry.DecryptStringAES(card.CreditNumber), card.Expire, card.CVC); if (bankCredit != null) { var cart = SessionHelper.GetSession(AppSettingConstant.CartSession) as List <CartItem>; var amount = cart.Sum(c => c.Quantity * (c.Product.ProductPrice + c.Material.Price)); string rootPath = "~/Images/Upload/"; var extenPath = string.Format("{0}/{1}_{2}", user.Username, DateTime.Now.Second, DateTime.Now.Millisecond); string path = Server.MapPath(rootPath + extenPath); //Path //Check if directory exist if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); //Create directory if it doesn't exist } foreach (var item in cart as List <CartItem> ) { string imgPath = Path.Combine(path, item.ImageTitle); byte[] imageBytes = Convert.FromBase64String(item.Image); System.IO.File.WriteAllBytes(imgPath, imageBytes); } if (bankCredit.Balance >= amount) { bankCredit.Balance -= amount.Value; List <OrderDetail> orderDetails = new List <OrderDetail>(); foreach (var item in cart) { OrderDetail orderDetail = new OrderDetail() { MaterialId = item.Material.Id, ProductId = item.Product.ProductId, Quantity = item.Quantity, Option = item.Option, Image = item.ImageTitle }; orderDetails.Add(orderDetail); } orderSession.CreditCardId = card.CreditCardId; orderSession.CreatedAt = DateTime.Now; orderSession.Status = OrderStatus.Pending; orderSession.CustomerId = user.CustomerId; orderSession.FolderImage = extenPath; orderSession.IsCancel = true; var transac = _orderServiceTrans.TransactionPayment(orderSession, orderDetails, bankCredit); if (transac != null) { var addressDetails = _addressRepository.Find(a => a.AddressId == orderSession.AddressId); MailOrder model = new MailOrder(cart, transac.OrderId, user.Email, addressDetails.AddressDetails, user.Customer.CustomerName, card.CreditNumber, transac.FolderImage, amount.Value, transac.PhoneNumber); var body = ViewToString.RenderRazorViewToString(this, "MailOrder", model); var bodyAdmin = ViewToString.RenderRazorViewToString(this, "MailBackAdmin", model); string mailAdmin = ConfigurationManager.AppSettings["mailadmin"]; Task.Factory.StartNew((() => { SendEmail.Send(mailAdmin, bodyAdmin, "New order notification!"); SendEmail.Send(user.Email, body, "Your order information!"); })); SessionHelper.Delete(AppSettingConstant.CartSession); TempData["Success"] = "Order Success"; return(Json(new { status = true, message, transac.OrderId }, JsonRequestBehavior.AllowGet)); } else { if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } } } } } } } } return(Json(new { status = false, message }, JsonRequestBehavior.AllowGet)); }
public IActionResult Login(LoginViewModel loginViewModel, string btnLoginSubmit) { ModelState.Remove("ConfirmPassword"); ModelState.Remove("EnterOTP"); ModelState.Remove("NewPassword"); if (!ModelState.IsValid) { if (btnLoginSubmit == "KIOSK") { return(View("LoginKIOSKHome")); } else { return(View()); } } else { int flag = Convert.ToInt32(TempData["Flagforpwd"]); if (flag == 1) { ViewBag.Messages = new[] { new AlertModel("success", "Success!", "Password changed successfully") }; } try { loginViewModel.Password = AESEncrytDecry.DecryptStringAES(loginViewModel.Password); if (loginViewModel.UserId.Trim().Length != 8) { loginViewModel.UserId = loginViewModel.UserId.Trim().ToString().PadLeft(8, '0'); } var result = Mapper.Map <LoginViewModel>(_ILoginViewService.Authentication(Mapper.Map <LoginViewServiceModel>(loginViewModel))); if (result.ReturnsaveValue == 1) { ViewBag.Messages = new[] { new AlertModel("danger", "Warning!", "Incorrect UserID/Password. Your account will get locked out after 5 failure login attempts. If you've forgot password, please click on Forgot/Reset Password.") }; if (btnLoginSubmit == "KIOSK") { return(View("LoginKIOSKHome")); } else { return(View()); } } else if (result.ReturnsaveValue == 2) { TempData["flag"] = 1; TempData["EmployeeID"] = loginViewModel.UserId; return(RedirectToAction("GenerateOTP", "Account")); } else if (result.ReturnsaveValue == 3) { TempData["loginstatus"] = "concurrentlogin"; TempData["loginendtime"] = result.ReturnValMessg; return(RedirectToAction("LoginTimeout", "Home")); } else if (result.ReturnsaveValue == 4) { TempData["loginstatus"] = "loginattempfailed"; TempData["loginendtime"] = result.ReturnValMessg; return(RedirectToAction("LoginTimeout", "Home")); } else { string userName = result.EmployeeName; string EmailID = result.EmployeeMail; string EmployeeId = Convert.ToString(result.EmployeeID.Trim()); if (EmployeeId.Length != 8) { EmployeeId = EmployeeId.ToString().PadLeft(8, '0'); } string DOB = result.EmployeeDOB; string Grade = result.Grade; string Dept = result.Dept; string mobileno = (result.MobileNO); HttpContext.Session.SetString(Constant.SessionUserName, userName); HttpContext.Session.SetString(Constant.Category, result.Category.ToString()); HttpContext.Session.SetString(Constant.EmployeeID, EmployeeId.Trim().ToString()); HttpContext.Session.SetString("FirstName", userName); HttpContext.Session.SetString(Constant.PersonalArea, result.PersonalArea); HttpContext.Session.SetString(Constant.PersonalSubArea, result.PersonalSubArea); HttpContext.Session.SetString(Constant.MobileNo, mobileno.ToString()); ViewBag.UserName = HttpContext.Session.GetString(Constant.SessionUserName); HttpContext.Session.SetString(Constant.SessionModulName, "Employee"); string ModuleName = HttpContext.Session.GetString(Constant.SessionModulName); var EmployeeID = HttpContext.Session.GetString(Constant.EmployeeID); GetdataSAP(EmployeeID); var MenuItem = _ImenuServices.GetMenu(ModuleName, EmployeeId); MenuviewModel model = new MenuviewModel(); model.MenuModels = Mapper.Map <List <MenuModel> >(MenuItem); HttpContext.Session.SetObjectAsJson <MenuviewModel>(Constant.Menu, model); } } catch (Exception ex) { _logger.LogError(ex, ex.Message); ViewBag.Messages = new[] { new AlertModel("danger", "Warning!", "Please try after some time") }; if (btnLoginSubmit == "KIOSK") { return(View("LoginKIOSKHome")); } else { return(View()); } } return(RedirectToAction("LeaveDashboard", "LeaveDashboard")); } }
public static string CallClosed(string IssueTitle, string strKioskID, string strSerialNumber, string strbrCode, string personName, string personNumber, string IssueDetails) { try { string StrURL = System.Configuration.ConfigurationManager.AppSettings["URL"].ToString(); ReqTicketGenerate objReq = new ReqTicketGenerate(); ResCallClose objRes = new ResCallClose(); using (WebClient client = new WebClient()) { objReq.KioskID = AESEncrytDecry.DecryptStringAES(strKioskID); objReq.brCode = AESEncrytDecry.DecryptStringAES(strbrCode); objReq.ContactPersonMobile = AESEncrytDecry.DecryptStringAES(personNumber); objReq.ContactPerson = AESEncrytDecry.DecryptStringAES(personName); objReq.IssueTitle = IssueTitle; objReq.ProblemDescription = AESEncrytDecry.DecryptStringAES(IssueDetails); objReq.Sender = HttpContext.Current.Session["PF_Index"].ToString(); client.Headers[HttpRequestHeader.ContentType] = "text/json"; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string JsonString = JsonConvert.SerializeObject(objReq); EncRequest objEncRequest = new EncRequest(); objEncRequest.RequestData = AesGcm256.Encrypt(JsonString); string dataEncrypted = JsonConvert.SerializeObject(objEncRequest); string result = client.UploadString(StrURL + "/CallClose", "POST", dataEncrypted); // , "\"" + parameter + "\"" | GetDashBoardDetail |GetHealthTxnDataWithState EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(result); objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData); //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData); //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply)); //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData)); //objRes = (ResTicketGenerate)objDCS.ReadObject(objMS); Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer(); json.NullValueHandling = NullValueHandling.Ignore; StringReader sr = new StringReader(objResponse.ResponseData); Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr); objRes = json.Deserialize <ResCallClose>(reader); if (objRes.success == true) { return("Call Close Successfully On Ticket No :- " + objRes.openTicketNumber); } else { if (objRes.error != null) { return("Call Close Failed : " + objRes.error[0].errorCode + " " + "Error Msg : " + objRes.error[0].errorMessage); } else { return("Call Close Failed : No Connectivity"); } } } } catch (Exception ex) { return("Call Close Failed"); } }
protected void btnCreateUser_Click(object sender, EventArgs e) { try { if (btnCreateUser.Text == "Modify The User") { strUser1 = AESEncrytDecry.EncryptStringAES(usernametext2.Text); } else { strUser1 = usernametext2.Text; } string strUser = AESEncrytDecry.DecryptStringAES(strUser1); usernametext2.Text = ""; string strpassword = AESEncrytDecry.DecryptStringAES(password.Text); password.Text = ""; string strReptpassword = AESEncrytDecry.DecryptStringAES(repeatPassword.Text); repeatPassword.Text = ""; string strSans = AESEncrytDecry.DecryptStringAES(answer.Text); answer.Text = ""; string strMobile = AESEncrytDecry.DecryptStringAES(mobile_phone.Text); mobile_phone.Text = ""; if (!strpassword.Any(char.IsUpper) || !strpassword.Any(char.IsLower) || strpassword.Length < 8 || !hasSpecialChar(strpassword) || !strpassword.Any(char.IsDigit) || strpassword.Length > 14) { password.Attributes["value"] = ""; repeatPassword.Attributes["value"] = ""; var page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "UserAlert('Password Must Contain atleast One Upper Case, One Lower Case, One Special Character, One Numeric Value and minimum length is 8');", true); return; } WebClient client = new WebClient(); UserDetails userDetails = new UserDetails(); userDetails.res = false; if (btnCreateUser.Text == "Create New User") { client.Headers[HttpRequestHeader.ContentType] = "text/json"; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string JsonString1 = JsonConvert.SerializeObject(strUser); EncRequest objEncRequest1 = new EncRequest(); objEncRequest1.RequestData = AesGcm256.Encrypt(JsonString1); string dataEncrypted1 = JsonConvert.SerializeObject(objEncRequest1); string result = client.UploadString(URL + "/GetUserDetails", "POST", dataEncrypted1); EncResponse objResponse1 = JsonConvert.DeserializeObject <EncResponse>(result); objResponse1.ResponseData = AesGcm256.Decrypt(objResponse1.ResponseData); //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData); //DataContractJsonSerializer objDCS1 = new DataContractJsonSerializer(typeof(Reply)); //MemoryStream objMS1 = new MemoryStream(Encoding.UTF8.GetBytes(objResponse1.ResponseData)); //userDetails = (UserDetails)objDCS1.ReadObject(objMS1); Newtonsoft.Json.JsonSerializer json1 = new Newtonsoft.Json.JsonSerializer(); json1.NullValueHandling = NullValueHandling.Ignore; StringReader sr1 = new StringReader(objResponse1.ResponseData); Newtonsoft.Json.JsonTextReader reader1 = new JsonTextReader(sr1); userDetails = json1.Deserialize <UserDetails>(reader1); if (userDetails.res) { Response.Write("<script>alert('Username already Exist')</script>"); usernametext2.Text = ""; password.Text = ""; repeatPassword.Text = ""; useremail.Text = ""; mobile_phone.Text = ""; recoveryQuestion.SelectedIndex = 0; answer.Text = ""; UserType.SelectedIndex = 0; locationList.SelectedIndex = 0; return; } else { userDetails.res = true; } } userDetails.Username = strUser; userDetails.Usertype = UserType.SelectedValue == "Admin User" ? "admin" : UserType.SelectedValue; userDetails.location = UserType.SelectedItem.Text == "Admin User" ? "Admin User" : locationList.SelectedItem.Text; userDetails.Answer = strSans; userDetails.email = useremail.Text; if (Session["Pass"] != null && Session["Pass"].ToString() == strpassword) { userDetails.password = strpassword; } else { userDetails.password = "******" + strpassword; } userDetails.phone = strMobile; userDetails.securityQuestion = recoveryQuestion.SelectedItem.Text; client.Headers[HttpRequestHeader.ContentType] = "text/json"; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string JsonString = JsonConvert.SerializeObject(userDetails); EncRequest objEncRequest = new EncRequest(); objEncRequest.RequestData = AesGcm256.Encrypt(JsonString); string dataEncrypted = JsonConvert.SerializeObject(objEncRequest); string resultUser = client.UploadString(URL + "/CreateUser", "POST", dataEncrypted); EncResponse objResponse = JsonConvert.DeserializeObject <EncResponse>(resultUser); objResponse.ResponseData = AesGcm256.Decrypt(objResponse.ResponseData); //objRes = JsonConvert.DeserializeObject<Reply>(objResponse.ResponseData); //DataContractJsonSerializer objDCS = new DataContractJsonSerializer(typeof(Reply)); //MemoryStream objMS = new MemoryStream(Encoding.UTF8.GetBytes(objResponse.ResponseData)); //resultUser = (string)objDCS.ReadObject(objMS); Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer(); json.NullValueHandling = NullValueHandling.Ignore; StringReader sr = new StringReader(objResponse.ResponseData); Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr); userDetails = json.Deserialize <UserDetails>(reader); if (resultUser == "true") { var page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "UserSuccess();", true); Session["Pass"] = null; UserType.SelectedIndex = 0; locationList.Items.Clear(); locationList.Items.Add("Select"); usernametext2.Text = ""; password.Text = ""; repeatPassword.Text = ""; useremail.Text = ""; mobile_phone.Text = ""; answer.Text = ""; recoveryQuestion.SelectedIndex = 0; reset.Enabled = true; usernametext2.Enabled = true; password.Attributes["value"] = ""; repeatPassword.Attributes["value"] = ""; btnCreateUser.Text = "Create New User"; reset.Enabled = true; locationList.Enabled = false; } else { PageUtility.MessageBox(this, "UserFail."); } } catch (Exception ex) { PageUtility.MessageBox(this, "Excp -: " + ex.Message); } finally { bindUserList(); } }
public JsonResult GetCredit(long id) { try { UserSession userSession = SessionHelper.GetSession(AppSettingConstant.LoginSessionCustomer) as UserSession; if (userSession != null) { var user = _userRepository.Find(u => u.Status.Equals(Status.Active) && u.Username.Equals(userSession.Username)); if (user != null) { var credit = user.Customer.CreditCards.SingleOrDefault(a => a.CustomerId == user.CustomerId & a.CreditCardId == id & a.Status.Equals(Status.Active)); if (credit != null) { return(Json(new { status = true, credit = new { CreditNumber = AESEncrytDecry.DecryptStringAES(credit.CreditNumber).Substring(12, 4), credit.CreditCardId, credit.Expire } }, JsonRequestBehavior.AllowGet)); } } } } catch (Exception) { } return(Json(new { status = false }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(SignupModel model, FormCollection collection) { BALCommon CSvc = new BALCommon(ConStr); OragnisationMaster master = new OragnisationMaster(); //model.CountryList = CSvc.GetCountryList(0); //model.CityList = CSvc.GetCityList(0, 0); //model.StateList = CSvc.GetStateList(0, 0); if (ModelState.IsValid) { try { master = CSvc.GetOragnisationAlready(model.LEmailId); if (master.OMID == 0) { HttpPostedFileBase empimg = Request.Files["emppathimage"]; string folderpath = Constants.EMPATTACHMENT; if (empimg.ContentLength > 0) { string guidstring = Guid.NewGuid().ToString(); string _FileName = Path.GetFileName(empimg.FileName); string filepath = Path.Combine(Server.MapPath(folderpath) + guidstring + "_" + _FileName); string dbpath = Path.Combine(folderpath + guidstring + "_" + _FileName); empimg.SaveAs(filepath); master.OrgImage = dbpath; } else { string _FileName = "schooldummylogo.png"; string dbpath = Path.Combine(folderpath + _FileName); master.OrgImage = dbpath; } master.Oname = model.Oname; master.BOAddress = model.BOAddress; master.BOAddress2 = model.BOAddress2; master.BOCity = model.CITY_ID; master.BOPincode = model.BOPincode; master.LCountry = model.COUNTRY_ID; master.LState = model.STATE_ID; master.LDistict = model.LDistict; master.LArea = model.LArea; master.LEmailId = model.LEmailId; master.LMobile = model.LMobile; master.LPhone = model.LPhone; master.LWebsite = model.LWebsite; master.OAfficilate = model.OAfficilate; master.OlicNo = model.OlicNo; master.OTaxNo = model.OTaxNo; master.OPanNo = model.OPanNo; master.OContactNo = model.OContactNo; master.IsActive = false; master.Createddate = DateTime.Now; master.Modifieddate = DateTime.Now; master.CreatedBy = "EndUser"; master.ModifiedBy = "EndUser"; master.Otype = "INS"; // to check int _retua = CSvc.OragnasitionBasicopation(master); if (_retua > 0) { string Password = Utility.GenerateRandomPassword(); WebSecurity.CreateUserAndAccount(master.LEmailId, Password, new { Name = master.OContactNo, Mobile = master.LMobile, EmailId = master.LEmailId, Address = master.BOAddress, RoleId = 1, CITY_ID = master.BOCity, STATE_ID = master.LState, COUNTRY_ID = master.LCountry, ISACTIVE = 0, SchoolID = _retua }); CSvc.Firstuserconfigure(_retua);//first user configure //TempData[Constants.MessageInfo.SUCCESS] = Constants.Orgnisation_ADD_SUCCESS; #region SendMail MailDetails _MailDetails = new MailDetails(); _MailDetails.ToMailIDs = master.LEmailId; _MailDetails.HTMLBody = true; _MailDetails.Subject = "Organisation Registration"; _MailDetails.Body = BALMail.TemplateOrganisation(master, AESEncrytDecry.EncryptStringAES(Password)); if (BALMail.SendMail(_MailDetails)) { TempData[Constants.MessageInfo.SUCCESS] = Constants.Orgnisation_ADD_SUCCESS + ", Please check your mail inbox for more information."; } else { TempData[Constants.MessageInfo.SUCCESS] = Constants.Orgnisation_ADD_SUCCESS; } #endregion SendMail return(RedirectToAction("login")); } } else { TempData[Constants.MessageInfo.SUCCESS] = "Orgnisation is already Exist !"; return(RedirectToAction("Create")); } } catch (Exception ex) { WebSecurity.Logout(); ExecptionLogger.FileHandling("Account(Create_Post)", "Error_014", ex, "Account"); } } return(View(model)); }