public JsonResult passwprd(string pasword) { PasswordRules pw = new PasswordRules(); int dif = 0; string result = ""; if (pw.GeneratePasswordScore(pasword) > 80) { result = "Şifreniz güçlü"; } else if (pw.GeneratePasswordScore(pasword) >= 60) { result = "Şifreniz orta seviye"; } else if (pw.GeneratePasswordScore(pasword) < 60) { result = "Şifreniz zayıf"; } dif = pw.GeneratePasswordScore(pasword); return(Json(new { data = dif, message = result }, JsonRequestBehavior.AllowGet)); }
public JsonResult personalRegister(string Name, string Surname, string BirthDay, string Contact, string City, string State, string Address, string Email, string Password) { try { var image = System.Web.HttpContext.Current.Request.Files[0]; using (business.Management.UserManagement.UserFunctions userManagement = new business.Management.UserManagement.UserFunctions()) { PasswordRules pw = new PasswordRules(); ImageProcess Ip = new ImageProcess(); if (!userManagement.isPersonalExist(Email)) { if (pw.GeneratePasswordScore(Password) >= 60) { string hashedPW = Crypting.En_De_crypt._Encrypt(Password); string filename = null; if (image != null && (image.ContentType == "image/jpeg" || image.ContentType == "image/jpg" || image.ContentType == "image/png")) { filename = Ip.Resolution(image, new int[] { 128, 256, 512 }, Email.Split('@')[0], "UserPicture"); } else { filename = $"user_default.png"; } Personal newPersonal = new Personal { OwnFirmId = Convert.ToInt64(Session["personalFirmId"]), personalUserId = userManagement.addUser(new db.Tables.User { EncryptedPassword = hashedPW, Token = Guid.NewGuid().ToString(), Role = "Personal", UserName = Email.ToString(), Image = filename, EmailVeryfied = false }), Name = Name.ToString(), Surname = Surname.ToString(), BirthDay = BirthDay.ToString(), Contact = Contact.ToString(), City = City.ToString(), State = State.ToString(), Address = Address.ToString(), Mail = Email.ToString(), Password = hashedPW, Register_Date = DateTime.Now, Login_Date = default(DateTime), Status = true }; userManagement.addPersonal(newPersonal); BuildEmailTemplate(newPersonal.personalUserId); return(Json(new { result = true, redirect = "Login", message = "Kaydınız başarılı bir şekilde oluşturuldu." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = false, message = "Şifreniz zayıf daha güçlü bir şifre giriniz." }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { redirect = "Password", result = false, message = "Giriş yaptığınız mail sisteme kayıtlı." }, JsonRequestBehavior.AllowGet)); } } } catch (Exception) { return(Json(new { message = "Hata Oluştu." }, JsonRequestBehavior.AllowGet)); } }
public JsonResult clientRegister(string Name, string Surname, string Emailc, string Password, string Contact) { try { var image = System.Web.HttpContext.Current.Request.Files[0]; ImageProcess Ip = new ImageProcess(); using (business.Management.UserManagement.UserFunctions userManagement = new business.Management.UserManagement.UserFunctions()) { PasswordRules pw = new PasswordRules(); int wfsNumber = Convert.ToInt32(Session["wfs"]); string role; bool IsUser; if (wfsNumber == 1) { role = "CustomerManager"; IsUser = false; } else { role = "ClientManager"; IsUser = true; } if (!userManagement.isManagerExist(Emailc)) { if (pw.GeneratePasswordScore(Password) >= 60) { string hashedPW = Crypting.En_De_crypt._Encrypt(Password); string filename = null; if (image != null && (image.ContentType == "image/jpeg" || image.ContentType == "image/jpg" || image.ContentType == "image/png")) { filename = Ip.Resolution(image, new int[] { 128, 256, 512 }, Emailc.Split('@')[0], "UserPicture"); } else { filename = $"user_default.png"; } ClientManager newManager = new ClientManager { managerUserId = userManagement.addUser(new db.Tables.User { EncryptedPassword = hashedPW, Token = Guid.NewGuid().ToString(), Role = role, UserName = Emailc, Image = filename, EmailVeryfied = false }), Name = Name, Surname = Surname, Email = Emailc, Password = hashedPW, Contact = Contact, Register_Date = DateTime.Now, Login_Date = default(DateTime), Status = true, ManagerFirmId = (long)Session["latest"], IsWFSuser = IsUser }; userManagement.addClientManager(newManager); BuildEmailTemplate(newManager.managerUserId); return(Json(new { result = true, redirect = "Login", message = "Kaydınız başarılı bir şekilde oluşturuldu." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = false, message = "Şifreniz zayıf daha güçlü bir şifre giriniz." }, JsonRequestBehavior.AllowGet)); } } else { using (business.Management.FirmManagement.FirmFunctions fm = new business.Management.FirmManagement.FirmFunctions()) { fm.deleteFirm((long)Session["latest"]); } return(Json(new { message = "Giriş yaptığınız bilgiler sistemde kayıtlı lütfen bilgilerinizi kontrol ediniz." }, JsonRequestBehavior.AllowGet)); } } } catch (Exception e) { return(Json(new { message = "Hata Oluştu." }, JsonRequestBehavior.AllowGet)); } }
public async Task <JsonResult> ProfileUpdate(string Name, string Surname, string Contact, string Email, string Password) { var user = web.Session.SessionUser.User; ImageProcess Ip = new ImageProcess(); try { var image = System.Web.HttpContext.Current.Request.Files[0]; string filename = null; if (image != null && (image.ContentType == "image/jpeg" || image.ContentType == "image/jpg" || image.ContentType == "image/png")) { filename = Ip.Resolution(image, new int[] { 128, 256, 512 }, user.User.UserName.Split('@')[0], "UserPicture"); } else { filename = user.User.Image; } using (business.Management.UserManagement.UserFunctions userM = new business.Management.UserManagement.UserFunctions()) { PasswordRules pw = new PasswordRules(); string hashedPW = Password; if (pw.GeneratePasswordScore(Password) >= 60) { if (Password != user.User.EncryptedPassword) { hashedPW = business.SessionSettings.Crypting.En_De_crypt._Encrypt(Password); } bool verify = true; if (Email != user.User.UserName) { if (user.User.Role == "ClientManager") { if (userM.isManagerExist(Email)) { return(Json(new { result = false, message = "Girdiğiniz bilgiler sistemde kayıtlı..." }, JsonRequestBehavior.AllowGet)); } } else { if (userM.isPersonalExist(Email)) { return(Json(new { result = false, message = "Girdiğiniz bilgiler sistemde kayıtlı..." }, JsonRequestBehavior.AllowGet)); } } BuildEmailTemplate(user.User.UserId); verify = false; } User updateuser = new User { UserName = Email, EncryptedPassword = hashedPW, Image = filename, EmailVeryfied = verify }; if (userM.updateUser(updateuser, user.User.UserId)) { if (user.User.Role.Contains("ClientManager")) { ClientManager updateManager = new ClientManager { Name = Name, Surname = Surname, Email = Email, Password = hashedPW, Contact = Contact, }; if (userM.updateClientManager(updateManager, user.ClientManager_Id)) { return(Json(new { result = true, message = "Bilgileriniz güncellendi." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = false, message = "Bilgileriniz güncellenemedi." }, JsonRequestBehavior.AllowGet)); } } else { Personal updatePersonal = new Personal { Name = Name, Surname = Surname, Contact = Contact, Mail = Email, Password = hashedPW }; if (userM.updatePersonal(updatePersonal, user.Personal_Id)) { return(Json(new { result = true, message = "Bilgileriniz güncellendi." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = false, message = "Bilgileriniz güncellenemedi." }, JsonRequestBehavior.AllowGet)); } } } else { return(Json(new { result = false, message = "Bilgileriniz güncellenemedi." }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { result = false, message = "Şifreniz zayıf daha güçlü bir şifre giriniz." }, JsonRequestBehavior.AllowGet)); } } } catch (Exception e) { return(Json(new { result = false, message = "Hata oluştu" }, JsonRequestBehavior.AllowGet)); } }