public JsonResult Login(LoginModal model) { //to do: Implement user login //var data = _userManager.AdminLogin(model); var data = new ActionOutput <UserDetails>(); var adminLogin = _userManager.AdminLogin(model); if (adminLogin != null) { data.Status = ActionStatus.Successfull; data.Object = new UserDetails { UserID = adminLogin.UserId, FirstName = model.UserName, UserName = model.UserName, IsAuthenticated = true }; } else { data.Status = ActionStatus.Error; data.Message = "Invalid Credentials."; } if (data.Status == ActionStatus.Successfull) { var user_data = data.Object; CreateCustomAuthorisationCookie(model.UserName, false, new JavaScriptSerializer().Serialize(user_data)); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public void OnEnterModal() { if (loginModal == null) { loginModal = ModalManager.Instance.LoadModal(typeof(LoginModal)) as LoginModal; } }
public JsonResult Login(LoginModal model) { //to do: Implement user login var data = _userManager.AdminLogin(model); if (data.Status == ActionStatus.Successfull) { data.Object = new UserModel { FirstName = data.Object.FirstName, LastName = data.Object.LastName, Email = data.Object.Email, UserID = data.Object.UserID, IsApproved = true, //IsSuperAdmin = data.Object.IsSuperAdmin }; } else { data.Status = ActionStatus.Error; data.Message = "Invalid Credentials."; } if (data.Status == ActionStatus.Successfull) { //var user_data = data.Object; //CreateCustomAuthorisationCookie(model.UserName, false, new JavaScriptSerializer().Serialize(user_data)); var PermissonAndDetailModel = new PermissonAndDetailModel(); PermissonAndDetailModel.UserDetails = data.Object; PermissonAndDetailModel.ModulesModelList = _userManager.GetAllModulesAtAuthentication(data.Object.UserID); CreateCustomAuthorisationCookie(model.UserName, true, new JavaScriptSerializer().Serialize(PermissonAndDetailModel)); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public User LoginUser(LoginModal LoginModal) { try { string command = "select * from dbo.Users where " + $"Email='{LoginModal.Email}' " + "AND " + $"Password='******' " + "AND " + "is_deleted = 0"; DataSet ds = ExecuteQuery(command); if (ds.Tables[0].Rows.Count == 1) { return(new User { UserId = Convert.ToInt32(ds.Tables[0].Rows[0]["UserId"]), UserName = Convert.ToString(ds.Tables[0].Rows[0]["UserName"]), RoleId = Convert.ToInt32(ds.Tables[0].Rows[0]["RoleId"]), Email = Convert.ToString(ds.Tables[0].Rows[0]["Email"]) }); } else { throw new Exception("incorrect details provided"); } } catch (Exception Ex) { throw Ex; } }
public async Task <IActionResult> Login(LoginModal loginUser) { if (string.IsNullOrWhiteSpace(loginUser.Email) || string.IsNullOrWhiteSpace(loginUser.password)) { return(BadRequest("Email or password is null")); } AppUser user = await _userManager.FindByEmailAsync(loginUser.Email); if (user == null) { return(BadRequest("Invalid Email or password")); } if (!user.EmailConfirmed) { return(BadRequest("Please confirm your email")); } var signin = await _signInManager.PasswordSignInAsync(user, loginUser.password, isPersistent : false, lockoutOnFailure : false); Log.Information($"the sigin {signin}"); if (signin.Succeeded) { return(await GetLoginedUserdata(loginUser.Email)); } return(BadRequest("Invalid Email or password")); }
public void FindElementsKika() { KikaHomePage kikaHomePage = new KikaHomePage(); LoginModal loginModal = new LoginModal(); PopUpModal popUpModal = new PopUpModal(); Driver.Current.Url = "https://www.kika.lt/"; popUpModal.ClosePopUpModal(); kikaHomePage.Header.ClickLoginIconButton(); Thread.Sleep(2000); loginModal.Login("*****@*****.**", "testeris888"); Thread.Sleep(2000); var elementKikaWishListBubbleCount = Driver.Current.FindElement(By.CssSelector("#wishlist_info .cnt")); var e1 = elementKikaWishListBubbleCount.Text; Console.WriteLine($"Wishlist bubble element value is: {e1}"); var elementKikaCartBubbleCount = Driver.Current.FindElement(By.CssSelector("#cart_info .cnt")); var e2 = elementKikaCartBubbleCount.Text; Console.WriteLine($"Cart bubble element value is: {e2}"); Thread.Sleep(2000); }
ActionOutput <UserDetails> IUserManager.AdminLogin(LoginModal model) { model.Password = Utilities.EncryptPassword(model.Password, true); var user = Context.AdminUsers.Where(x => x.Email == model.UserName && x.Password == model.Password && x.IsDeleted == false).FirstOrDefault(); if (user != null) { //user.IsPermissonUpdated = false; Context.SaveChanges(); return(new ActionOutput <UserDetails> { Status = ActionStatus.Successfull, Object = new UserDetails { UserID = user.AdminUserId, FirstName = user.FirstName, LastName = user.LastName, IsAuthenticated = true, UserEmail = user.Email, //IsSuperAdmin = user.IsSuperAdmin.GetValueOrDefault(false) } }); } else { return(new ActionOutput <UserDetails> { Status = ActionStatus.Error, Message = "User Does Not Exists" }); } }
public void OnExitModal() { if (loginModal != null) { ModalManager.Instance.RemoveModal(loginModal); loginModal.Destroy(); loginModal = null; } }
public JsonResult UserLogin(LoginModal model) { //to do: Implement user login //var data = _userManager.AdminLogin(model); var user = _userManager.UserLogin(model); var data = new ActionOutput <UserDetails>(); BindLoginDetails(ref data, ref user, ref model); return(Json(data, JsonRequestBehavior.AllowGet)); }
public void GivenAUserHasAccounts(int p0) { var sideMenu = AccountPage.NavigateTo(driver).WaitUntilVisible() .OpenSideMenu().WaitUntilVisible(); sideMenu.ClickMenuItemByText("Login"); var loginDialog = new LoginModal(driver).WaitUntilVisible(); loginDialog.LoginUser("heaton"); }
public static String UpdateUserDetail(LoginModal objUserData) { try { CommonDA CommonDA = new CommonDA(); return(CommonDA.UpdateUserDetail(objUserData)); } catch { throw; } }
//public long InsertOfficeDetailsBL(DDbind commonbo) //{ // try // { // CommonDA objCommonda = new CommonDA(); // Creating object of Dataccess // return objCommonda.InsertOfficeDetailsDA(commonbo); // calling Method of DataAccess // } // catch // { // throw; // } //} internal static LoginModal GetUserDetail(LoginModal objUserData) { try { CommonDA CommonDA = new CommonDA(); return(CommonDA.GetUserDetail(objUserData)); } catch { throw; } }
private void AdminBtn_Click(object sender, System.EventArgs e) { var login = new LoginModal(this); var result = login.ShowDialog(); if (result == DialogResult.OK) { Hide(); worldMapUsers.Hide(); new AdminPanel.AdminPanel(Client).Show(); } }
public HttpResponseMessage login(LoginModal model) { PushNotify _notify = new PushNotify(); // Check last session exist or not if (_userManager.IsAlreadySessionExist(model)) { //remove the all previous sessions of user _userManager.ExpirePreviousSessions(model); //var lastSession = _userManager.GetLastSessionDetails(model); //// if exist then send a notification that your session has expired //if (lastSession != null) //{ //if (lastSession.DeviceType == DeviceType.Android) //{ // var gcmModel = new GCM_Session_Expired() // { // GCM_ID = "GCM_SESSION_EXPIRED", // Message = Messages.GCM_SESSION_EXPIRED // }; // var notificationStack = new NotificationStackModel() // { // UserId = lastSession.UserId, // Priority = Priority.High, // Status = BLL.Models.NotificationStatus.Pending, // DeviceId = lastSession.DeviceToken, // Message = gcmModel, // }; // var notificatioStack = _notificationStackManager.AddOrUpdateStack(notificationStack); //} // } } var result = _userManager.AuthenticateUserOnMobile(model); if (result.Status == ActionStatus.Successfull) { try { if (result.Object.DeviceType == (short)DeviceType.IOS) { PushNotifier.NotifyIOSUser(result.Object.DeviceToken, "Login successfully", NotificationType.MessageAlert); } } catch (Exception ex) { _errorLogManager.LogStringExceptionToDatabase(ex.Message); } return(new JsonContent("Login Successfull", result.Status, result.Object).ConvertToHttpResponseOK()); } return(new JsonContent(result.Message, result.Status).ConvertToHttpResponseOK()); }
public static LoginModal Instance() { if (_Instance == null) { _Instance = FindObjectOfType <LoginModal>(); if (_Instance == null) { Debug.LogError("there is no LoginModal in the system"); } } return(_Instance); }
public IHttpActionResult Login([FromBody] LoginModal loginModal) { ErrorMessage errorMessage = authenticationBL.Login(loginModal); if (errorMessage.Code == HttpStatusCode.OK) { User user = userBL.GetUserByEmail(loginModal.Email); user.Password = null; return(Ok(user)); } return(new ResponseMessageResult(Request.CreateErrorResponse( errorMessage.Code, new HttpError(errorMessage.Message) ) )); }
public ActionResult Giris(LoginModal model) { if (ModelState.IsValid) { KullaniciYonet ky = new KullaniciYonet(); BLHatalar <Kullanicilar> kayitsonuc = ky.LoginUser(model); if (kayitsonuc.Hata.Count > 0) { kayitsonuc.Hata.ForEach(x => ModelState.AddModelError("", x)); return(View(model)); } Session["login"] = kayitsonuc.sonuc; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Login(LoginModal modal) { User user = (from u in db.Users join ur in db.UserRoles on u.Id equals ur.UserId where u.Email == modal.Email && u.Password == modal.Password && ur.RoleId == 1 select u).FirstOrDefault(); if (user != null) { FormsAuthentication.SetAuthCookie(modal.Email, false); return(RedirectToAction("Index", "Candidates")); } else { ViewBag.Error = "Invalid Credentials"; } return(View()); }
public BLHatalar <Kullanicilar> LoginUser(LoginModal data) { //giriş kontrolü //hesap aktive edilmiş mi? kullaniciSonuc.sonuc = rep_kul.Find(x => x.KullaniciAd == data.KullaniciAd && x.Sifre == data.Sifre); if (kullaniciSonuc.sonuc != null) { if (!kullaniciSonuc.sonuc.Aktif) { kullaniciSonuc.Hata.Add("Kullanıcı aktifleştirilmemiştir! Lütfen e-posta adresinizi kontrol ediniz."); } } else { kullaniciSonuc.Hata.Add("Kullanıcı adı veya şifre uyuşmuyor."); } return(kullaniciSonuc); }
public ErrorMessage Login(LoginModal loginModal) { if (string.IsNullOrEmpty(loginModal.Email) || string.IsNullOrEmpty(loginModal.Password)) { ErrorMessage message = new ErrorMessage { Code = HttpStatusCode.NotModified, Message = "Validation Error" }; return(message); } else { try { HashWithSaltResult hashResultSha256 = pwHasher.HashWithSalt(loginModal.Password, loginModal.Email); loginModal.Password = hashResultSha256.Digest + hashResultSha256.Salt; User user = usersCRUD.Login(loginModal); if (user != null) { ErrorMessage message = new ErrorMessage { Code = HttpStatusCode.OK, }; return(message); } else { ErrorMessage message = new ErrorMessage { Code = HttpStatusCode.NotModified, Message = "Validation Error" }; return(message); } } catch (Exception e) { throw e; } } }
public HttpResponseMessage Login(LoginModal LoginModal) { if (ModelState.IsValid) { AuthService service = new AuthService(); User user = service.LoginUser(LoginModal); Response <User> result = new Response <User>() { status = true, Message = "login sucessfully", Body = user }; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result); return(response); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } }
public async Task <IActionResult> Login(LoginModal user) { var userDetail = await _auth.GetUser(user.Username, user.Password); if (userDetail == null) { return(Unauthorized()); } var claims = new[] { new Claim(ClaimTypes.NameIdentifier, protector.Protect(userDetail.Id.ToString())), new Claim(ClaimTypes.Name, userDetail.Username), new Claim(ClaimTypes.GivenName, userDetail.Name), }; var accessToken = _tokenService.GenerateAccessToken(claims); return(Ok(new { token = accessToken })); }
ActionOutput <UserModel> IUserManager.AdminLogin(LoginModal model) { ActionOutput <UserModel> res = new ActionOutput <UserModel>(); try { model.Password = UtilitiesHelp.EncryptPassword(model.Password, true); //var HashPass = EncryptionHelper.EncryptToByte(model.Password); var user = Context.UserTbls.Where(p => p.Email == model.UserName && p.Password == model.Password && p.RoleId == (int)UserRoleTypes.Admin).FirstOrDefault(); if (user != null) { //user.IsPermissonUpdated = false; Context.SaveChanges(); res.Status = ActionStatus.Successfull; res.Message = "Login Success"; res.Object = new UserModel { UserID = user.Id, FirstName = user.FirstName, LastName = user.LastName, }; } else { res.Status = ActionStatus.Error; res.Message = "User Does Not Exists"; } } catch (Exception ex) { res.Status = ActionStatus.Error; res.Message = "Some Error Occurred"; } return(res); }
private void BindLoginDetails(ref ActionOutput <UserDetails> data, ref UserModel user, ref LoginModal model) { if (user != null) { if (user.IsActivated == true) { data.Status = ActionStatus.Successfull; data.Object = new UserDetails { FirstName = user.FirstName, LastName = user.LastName, UserEmail = user.Email, ImageLink = user.ImagePath, UserName = user.Email, IsAuthenticated = true, UserID = user.UserId, // UserImage = user.Image, UserType = UserTypes.User, // LastUpdated = user.LastUpdated }; } else { data.Status = ActionStatus.Error; data.Message = "Registration is not Complete. Hygge Mail has sent you a verification email with a link. Please click that link to complete your registration."; } } else { data.Status = ActionStatus.Error; data.Message = "Your HyggeMail username or password was entered incorrectly.Please reset your Password. Don’t have a HyggeMail account? Create One."; } if (data.Status == ActionStatus.Successfull) { var user_data = data.Object; //if (model.RememberMe == true) //{ // SetRemember(model); //} CreateCustomAuthorisationCookie(model.UserName, model.RememberMe, new JavaScriptSerializer().Serialize(user_data)); } }
/// <summary> /// 站点登录页面 /// </summary> /// <param name="loginModal">登录模式</param> /// <param name="includeReturnUrl">是否包含returnUrl(默认为false)</param> /// <param name="returnUrl">回跳地址</param> public string Login(bool includeReturnUrl = false, LoginModal loginModal = LoginModal.login, string returnUrl = null, string callBack = null) { if (includeReturnUrl) { HttpContext httpContext = HttpContext.Current; string currentPath = httpContext.Request.Url.PathAndQuery; returnUrl = SiteUrls.ExtractQueryParams(currentPath)["ReturnUrl"]; if (string.IsNullOrEmpty(returnUrl)) returnUrl = WebUtility.UrlEncode(HttpContext.Current.Request.RawUrl); } else if (!string.IsNullOrEmpty(returnUrl)) { returnUrl = WebUtility.UrlEncode(returnUrl); } RouteValueDictionary dic = new RouteValueDictionary(); if (!string.IsNullOrEmpty(returnUrl)) dic.Add("returnUrl", returnUrl); switch (loginModal) { case LoginModal._login: return CachedUrlHelper.Action("_Login", "Account", CommonAreaName, dic); case LoginModal._LoginInModal: if (!string.IsNullOrEmpty(callBack)) dic.Add("callBack", callBack); return CachedUrlHelper.Action("_LoginInModal", "Account", CommonAreaName, dic); default: return CachedUrlHelper.Action("Login", "Account", CommonAreaName, dic); } }
public User Login(LoginModal loginModal) { return(context.Users.FirstOrDefault(user => user.Email == loginModal.Email && user.Password == loginModal.Password)); }