private async void Submit(object obj) { if (string.IsNullOrWhiteSpace(UserName)) { await dialogService.DisplayAlertAsync("Alert", "Please provide Username", "cancel"); } if (string.IsNullOrWhiteSpace(Password)) { await dialogService.DisplayAlertAsync("Alert", "Please provide Password", "cancel"); } AuthenticatUser result = null; try { var credentials = new Requests.LoginRequest(UserName, Password); var apiresult = await Apiservice.Login(credentials); result = JsonConvert.DeserializeObject <AuthenticatUser>(apiresult); } catch (Exception ex) { var action = dialogService.DisplayAlertAsync("Alert", ex.Message, "OK"); } if (result != null && result.status == "success") { if (!isalreadylogin) { App.Database.AddLoggedinUser(UserName, Password); } await this.NavigationService.NavigateAsync($"{nameof(TaskSelectionPage) }"); } }
public ActionResult postLogin(Requests.LoginRequest request, string next = "/") { /* if(!ModelState.IsValid) * { * ViewBag.error = ModelState.First().Value.Errors.Last().ErrorMessage; * return View(); * }*/ if (!Regex.IsMatch(request.Email, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")) { ViewBag.error = "Invalid Email Format !"; return(View()); } //var user = db.Users.Where(a => a.Email == request.Email).FirstOrDefault(); //if (user == null || user.Password != request.Password) //{ // ViewBag.error = "Invalid User Data !"; // return View(); //} //Session.RemoveAll(); //Session.Add("USER_ID", user.Usr_Id); var user = UserSession.Login(request.Email, BLL.SecurityHelper.MD5(request.Password), request.Remember).Result; if (user == null) { ViewBag.error = "Invalid User Data !"; return(View()); } return(Redirect(next)); }
private async void Button_Clicked(object sender, EventArgs e) { var Apiservice = NetworkService.GetApiService(); Dictionary <int, int> keyValuePairs = new Dictionary <int, int>(); var razaeq = new Requests.LoginRequest("*****@*****.**", "63261"); var jjjj = await Apiservice.Login(razaeq); }