Esempio n. 1
0
        protected void btnVerifyEmail_Click(object sender, EventArgs e)
        {
            string email = txtVerifyEmail.Text;

            if (email == "")
            {
                smlVerifyEmailHelp.InnerText = "Please enter your email address";
                return;
            }
            else
            {
                smlVerifyEmailHelp.InnerText = "";
            }

            UserService.UserService proxy = new UserService.UserService();
            bool verifyEmail = proxy.ValidateEmail(email);

            if (verifyEmail)
            {
                smlVerifyEmailHelp.InnerText = "Email does not belong to a profile, try again";
                return;
            }
            else
            {
                smlVerifyEmailHelp.InnerText = "";
            }

            UserService.User serviceUser = proxy.GetUserByEmail(email);
            User             recoverUser = new User(serviceUser.Username, serviceUser.FirstName, serviceUser.LastName,
                                                    serviceUser.Password, serviceUser.ProfileImage, serviceUser.HomeAddress, serviceUser.BillingAddress,
                                                    serviceUser.EmailAddress, serviceUser.Phone, serviceUser.SecretQuestions, serviceUser.SecretAnswers, serviceUser.Verified);

            int arrayIndex;
            int secretQuestion = recoverUser.GetRandomQuestion(out arrayIndex);

            lblUsernameSecretQuestion.InnerText = securityQuestions[secretQuestion];

            Session["UsernameRetrieve"] = recoverUser.Username;
            Session["SecretAnswer"]     = recoverUser.GetSecretAnswer(arrayIndex);

            divUsernameSecretQuestion.Visible = true;
        }