// GET api/ForgotPassword
        public HttpResponseMessage Post(ResetPasswordRequest request)
        {
            helpsDbContext context = new helpsDbContext();
            // Find the User with the token which was emailed to them
            User user = context.Users.Where(a => a.ForgotPasswordToken == request.ResetToken).SingleOrDefault();

            if (user != null)
            {
                if (request.Password != request.ConfirmPassword)
                {
                    request.Errors = "Passwords do not match";
                    return(ViewHelper.View("ResetPassword/Index", request));
                }
                else if (request.Password.Length < 8)
                {
                    request.Errors = "Password must be minimum 8 characters";
                    return(ViewHelper.View("ResetPassword/Index", request));
                }

                byte[] salt = LoginProviderUtil.generateSalt();
                user.Salt = salt;
                user.SaltedAndHashedPassword = LoginProviderUtil.hash(request.Password, salt);
                user.ForgotPasswordToken     = Guid.NewGuid().ToString();

                context.Entry(user).State = System.Data.Entity.EntityState.Modified;
                context.SaveChanges();

                return(ViewHelper.View("ResetPassword/Success"));
            }

            request.Errors = "An error occured";
            return(ViewHelper.View("ResetPassword/Index", request));
        }
        // GET api/ConfirmEmail
        public HttpResponseMessage Get(string Token)
        {
            helpsDbContext context = new helpsDbContext();
            // Find the User with the token which was emailed to them
            User user = context.Users.Where(a => a.ConfirmToken == Token).SingleOrDefault();

            if (user != null)
            {
                // Mark the user as confirmed
                user.Confirmed = true;
                // Update the database
                context.Entry(user).State = System.Data.Entity.EntityState.Modified;
                context.SaveChanges();
                //Return success
                return(ViewHelper.View("ConfirmEmail/Index", new { Message = "Email confirmed! Please navigate back to the app to log in" }));
            }
            return(ViewHelper.View("ConfirmEmail/Index", new { Message = "An error occured" }));
        }