public async static Task <bool> CheckUser(string username, string password) { try { LoginDetailsRef loginRef = new LoginDetailsRef(); LogInDetailsClass logincls = new LogInDetailsClass(); loginRef = await logincls.GetLogInDetailsPage(username, password); if (loginRef.LogInData != null && loginRef.LogInData.UserName != string.Empty || loginRef.LogInData.Password != string.Empty || string.IsNullOrWhiteSpace(Convert.ToString(loginRef.LogInData.Password))) { return(true); } else { return(false); } } catch (Exception xp) { return(false); } finally { } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.RequestContext.HttpContext.Request["g-recaptcha-response"] != null) { string privatekey = WebConfigurationManager.AppSettings["RecaptchaPrivateKey"]; string response = filterContext.RequestContext.HttpContext.Request["g-recaptcha-response"]; filterContext.ActionParameters["CaptchaValid"] = LogInDetailsClass.Validate(response, privatekey); } }
public async Task <ForgotPasswordDetailsRef> GetFogotPasswordDetails(string email, string password, string confirmPWD, string captcha) { ForgotPasswordDetailsRef FGDetailsRef = new ForgotPasswordDetailsRef(); try { string strEncrypt = string.Empty; strEncrypt = LogInDetailsClass.Encrypt(password, "TimsFirstEncryptionKey"); ForgotPasswordDetails fgModel = new ForgotPasswordDetails(); fgModel.Email = ""; fgModel.EncryptedPassword = strEncrypt; fgModel.UserName = email; HttpClient hclient = new HttpClient(); StringContent content = new StringContent(JsonConvert.SerializeObject(fgModel), Encoding.UTF8, "application/json"); var response = await hclient.PostAsync("https://api.insurethat.com.au/Api/Login", content); var result = await response.Content.ReadAsStringAsync(); if (result != null) { FGDetailsRef = JsonConvert.DeserializeObject <ForgotPasswordDetailsRef>(result); } else { FGDetailsRef.Status = "Failure"; FGDetailsRef.ErrorMessage.Add("Enter wrong Password"); } } catch (Exception xp) { FGDetailsRef.Status = "Failure"; FGDetailsRef.ErrorMessage.Add(xp.Message); } finally { } return(FGDetailsRef); }