Пример #1
0
        public ActionResult Register()
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var partialUserAccount = JsonConvert.DeserializeObject <SSOAccountRegistrationDTO>(json);

            // Set some sort of flag up for the User in DB.
            // When they try and register in our app after SSO's registration, check the flag.

            // Return successful response
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Пример #2
0
        public ActionResult ResetPassword() // I need the equivalent of [FromBody] to use for incoming JSON
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var partialUserAccount = JsonConvert.DeserializeObject <SSOAccountRegistrationDTO>(json);

            // We need to push this information to the database.
            //using(var context = new ECSContext())

            // Return successful response?
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
        public ActionResult Index()
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var credentials = JsonConverterService.DeserializeObject <AccountCredentialsDTO>(json);

            // Proccess any other information.

            // Check app DB for user.

            // Issue login information

            // Return successful response
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Пример #4
0
        public ActionResult VerifySecurityAnswers()
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var securityQuestions = JsonConverterService.DeserializeObject <AccountQuestionsDTO>(json);

            // Proccess any other information.

            // Verify User's answers.

            // Redirect User to Account reset password page??

            // Return successful response
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Пример #5
0
        public ActionResult ChangePassword()
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var credentials = JsonConverterService.DeserializeObject <AccountCredentialsDTO>(json);

            // Proccess any other information.

            // Submit new password to app DB.

            // After you finish the resetpassword action, we need to send the finished information to the SSO.
            PostNewPasswordToSSO(credentials);

            // Redirect User to Account reset password page??

            // Return successful response
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Пример #6
0
        public ActionResult SubmitUsername()
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var credentials = JsonConverterService.DeserializeObject <AccountCredentialsDTO>(json);

            // Proccess any other information.

            // Check DB for username

            // Send User's security questions.
            using (HttpClientService client = HttpClientService.Instance)
            {
                // send to client.
            }

            // Return successful response
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
        public ActionResult RegisterUser()
        {
            // Read Json from POST body.
            var json = ParseHttpService.ReadHttpPostBody(Request);

            // Deserialize the Json String
            var userAccount = JsonConverterService.DeserializeObject <AccountRegistrationDTO>(json);

            // Proccess any other information.
            //if (ModelState.IsValid)
            //{
            //    // Check SSO DB for User.
            //    //PostRegistrationToSSO(userAccount.Username);

            //    // If successful, save user to app DB. If not successful, reject registration.
            //    using (ECSContext context = new ECSContext())
            //    {
            //        context.Accounts.Add(new Account
            //        {
            //            UserName = userAccount.Username,
            //            Password = HashService.HashPasswordWithSalt(userAccount.Password, HashService.CreateSaltKey()), //ConfirmPassword = userAccount.ConfirmPassword
            //            SecurityAnswers = new ICollection<SecurityQuestionAccount>
            //            {
            //                new SecurityQuestionAccount
            //                {
            //                    Answer = userAccount.SecurityAnswers.ElementAt(0),
            //                    SecurityQuestion = userAccount.SecurityQuestions.ElementAt(0)
            //                },
            //                new SecurityQuestionAccount
            //                {
            //                    Answer = userAccount.SecurityAnswers.ElementAt(1),
            //                    SecurityQuestion = userAccount.SecurityQuestions.ElementAt(1)
            //                },
            //                new SecurityQuestionAccount
            //                {
            //                    Answer = userAccount.SecurityAnswers.ElementAt(2),
            //                    SecurityQuestion = userAccount.SecurityQuestions.ElementAt(2)
            //                }
            //            }
            //        });
            //        context.Users.Add(new User
            //        {
            //            Email = userAccount.Email,
            //            FirstName = userAccount.FirstName,
            //            LastName = userAccount.LastName,
            //            Address = userAccount.Address
            //        });
            //        context.ZipLocations.Add(new ZipLocation
            //        {
            //            ZipCode = userAccount.ZipCode,
            //            City = userAccount.City,
            //            State = userAccount.State
            //        });
            //    }
            //    context.SaveChanges();
            //    // return RedirectToAction();
            //}
            // Return successful response
            // return View(userAccount);
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }