Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            regex = new Regex(@"^[0-9]{6}$");
            string code  = textBox9.Text;
            Match  match = regex.Match(code);

            if (!match.Success)
            {
                if (code.Length == 6)
                {
                    label27.Text      = "Enter digits only";
                    label27.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    label27.Text      = "Please enter OTP code.";
                    label27.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                ClientRegistrationService.UserOtpVerification userOtpVerification = new ClientRegistrationService.UserOtpVerification()
                {
                    OneTimePasswordforVerification = Int32.Parse(code),
                    User_Email_Address             = emailAddress
                };
                //userOtpVerification.OneTimePasswordforVerification,userOtpVerification.User_Email_Address
                //Int32.Parse(code),emailAddress
                //ClientRegistrationService.OTP_Verified otpVerified = clientRegistration.verifyUser(userOtpVerification.OneTimePasswordforVerification,userOtpVerification.User_Email_Address);
                Boolean result = clientRegistration.verifyUser(userOtpVerification.OneTimePasswordforVerification, userOtpVerification.User_Email_Address);
                if (result)
                {
                    this.Hide();
                    login l1 = new login();
                    l1.Show();
                }
                else
                {
                    label27.Text      = "Invalid OTP code";
                    label27.ForeColor = System.Drawing.Color.Red;
                }
            }
        }