Ejemplo n.º 1
0
        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));
        }
    }
Ejemplo n.º 2
0
        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"
            });
        }
    }
Ejemplo n.º 3
0
        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));
        }