Example #1
0
        public ActionResult CompleteRegister([FromBody] CompleteRegisterModel value)
        {
            if (!string.IsNullOrWhiteSpace(value.DeviceResponse) &&
                !string.IsNullOrWhiteSpace(value.UserName))
            {
                try
                {
                    value.DeviceResponse = _memeberShipService.CompleteRegistration(value.UserName.Trim(),
                                                                                    value.DeviceResponse.Trim())
                        ? "Registration was successful."
                        : "Registration failed.";

                    return(View("CompletedRegister", new CompleteRegisterModel {
                        UserName = value.UserName, DeviceResponse = value.DeviceResponse
                    }));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    ModelState.AddModelError("CustomError", e.Message);

                    return(View("FinishRegister", value));
                }
            }

            ModelState.AddModelError("CustomError", "bad username/device response");
            return(View("FinishRegister", value));
        }
Example #2
0
 public void AddDevice(string deviceResponse)
 {
     if (!HttpContext.User.Identity.IsAuthenticated)
     {
         ModelState.AddModelError("", "User has timed out.");
         RedirectToAction("Login", "Home");
     }
     _memeberShipService.CompleteRegistration(HttpContext.User.Identity.Name, deviceResponse);
 }
Example #3
0
 public void AddDevice(string username, string deviceResponse)
 {
     _memeberShipService.CompleteRegistration(username, deviceResponse);
 }