public async Task <ActionResult <AccountMessage> > AccountRegister(RegisterAccount account) { if (!ModelState.IsValid) { return(new AccountMessage() { Success = false, Message = "Unknown validation error" }); } CaptchaCheck captcha = new CaptchaCheck(account.RecaptchaToken); if (!captcha.Verify()) { return new AccountMessage() { Success = false, Message = "Invalid captcha! Please refresh the page and try again." } } ; return(await _accountService.Register(account)); } }
public async Task <ActionResult <ApplicationCreateMessage> > AddWebsite(Website website) { CaptchaCheck captcha = new CaptchaCheck(website.RecaptchaToken); if (!captcha.Verify()) { return new ApplicationCreateMessage() { Success = false, Message = "Invalid captcha! Please try again." } } ; if (ModelState.IsValid) { Account account = (Account)HttpContext.Items["Account"]; return(await _app.CreateWebsite(account, website)); } return(new ApplicationCreateMessage() { Success = false, Message = "Unknown" }); } }
public async Task <ActionResult <AuthenticationResponse> > AccountLogin(LoginAccount account) { CaptchaCheck captcha = new CaptchaCheck(account.RecaptchaToken); if (!captcha.Verify()) { return new AuthenticationResponse() { Success = false, Message = "Invalid captcha! Please try again." } } ; return(await _accountService.Authenticate(account)); }