public async Task <ActionResult> Login(MainRequestModel model, string returnUrl) { try { // Verification. if (ModelState.IsValid) { var result = await _accountService.Login(model.LoginRequestModel.Email, model.LoginRequestModel.Password); if (result.FirebaseToken != "") { _accountService.SignInUser(result.User.Email, result.FirebaseToken, false, Request.GetOwinContext()); return(RedirectToLocal(returnUrl)); } // Setting. ModelState.AddModelError(string.Empty, "Invalid username or password."); } } catch (Exception ex) { // Info Console.Write(ex); ModelState.AddModelError(string.Empty, "Invalid username or password."); } // If we got this far, something failed, redisplay form return(View(model)); }
public async Task <ActionResult> SignUp(MainRequestModel requestModel) { try { if (string.IsNullOrEmpty(requestModel.SignUpRequestModel.Email)) { return(RedirectToAction("Login", "Account")); } await _accountService.SignUp(requestModel.SignUpRequestModel); ModelState.AddModelError(string.Empty, "Please Verify your email then login."); } catch (Exception e) { ModelState.AddModelError(string.Empty, e.Message); Console.WriteLine(e); } return(RedirectToAction("Login", "Account")); }