Exemple #1
0
        public void ShowMainMenu(signUp signUp)
        {
            Window1 win = new Window1();

            signUp.Close();
            win.Show();
        }
        private void signUp_Click(object sender, EventArgs e)
        {
            var signUp = new signUp();

            signUp.Show();
            Hide();
        }
        public void ShowSignUp(Window1 window1)
        {
            signUp signup = new signUp();

            window1.Close();
            signup.Show();
        }
Exemple #4
0
        private bool checkInput(signUp signUp)
        {
            char[] error = { '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}', '[', ']', '|', '\\', '/', '?', '=', '+', ' ' };
            int    index = signUp.txtUsername.Text.IndexOfAny(error);

            if (index != -1)
            {
                MessageBox.Show("Username chứa các kí tự đặc biệt và không hợp lệ ");
                return(false);
            }
            if (signUp.txtPassword.Password.ToString().Length < 6)
            {
                MessageBox.Show("Mật khẩu phải tối thiểu 6 kí tự ");
                return(false);
            }
            if (String.Compare(signUp.txtPassword.Password.ToString(), signUp.txtRePassword.Password.ToString()) != 0)
            {
                MessageBox.Show("Nhập lại mật khẩu chưa chính xác ");
                return(false);
            }
            if (signUp.txtFullname.Text.Trim() == "" || signUp.txtUsername.Text == "" || signUp.txtPassword.Password.ToString() == "")
            {
                MessageBox.Show("Các ô không được để trống");
                return(false);
            }
            return(true);
        }
Exemple #5
0
        public void TestMethod1()
        {
            signUp su = new signUp();

            su.loadPage();
            su.fill_1stStage();
            su.fill_2ndStage();
            su.fill_3rdStage();
            su.fill_4thStage();
            //Assert.
        }
Exemple #6
0
        public ActionResult signUp(signUp model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (NotesMarketPlaceEntities DBobj = new NotesMarketPlaceEntities())
                    {
                        Users u = new Users();
                        u.RoleID          = 1003;
                        u.FirstName       = model.FirstName;
                        u.LastName        = model.LastName;
                        u.EmailId         = model.EmailId;
                        u.Password        = model.Password;
                        u.IsEmailVerified = false;
                        u.CreatedDate     = DateTime.Now;
                        u.IsActive        = true;

                        DBobj.Users.Add(u);
                        DBobj.SaveChanges();

                        if (u.UserID > 0)
                        {
                            ModelState.Clear();
                            ViewBag.IsSuccess = "<p><span><i class='fas fa-check-circle'></i></span> Your account has been successfully created </p>";
                            TempData["name"]  = model.FirstName;


                            //  Email Verification Link
                            var activationCode = model.Password;
                            var verifyUrl      = "/User/VerifyAccount/" + activationCode;
                            var activationlink = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, verifyUrl);


                            // Sending Email
                            EmailVerification.SendVerifyLinkEmail(u, activationlink);
                            ViewBag.Title         = "NotesMarketPlace";
                            @TempData["UserName"] = model.FirstName.ToString();


                            return(RedirectToAction("emailverification", "User"));
                        }
                    }
                }

                return(View());
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Exemple #7
0
        public void payoneerSignUp()
        {
            signUp su = new signUp();

            su.loadPage();
            su.fill_1stStage();
            su.fill_2ndStage();
            su.fill_3rdStage();
            su.fill_4thStage();
            //wait in order to view the end on the registration process
            //no actual need for the wait
            //can be removed once the assert is fixed
            System.Threading.Thread.Sleep(30000);
            Assert.Fail();
        }
        public string smeSignUp([FromBody] signUp signUp)
        {
            User u = IUserobj.GetUser(signUp.email);

            // var s = IUserobj.Hash(signUp.fullName);
            //var secureKey = s.Substring(0, 5);
            string secureKey = "mybro";

            if (u != null)
            {
                string x = "User already exist";
                return(JsonConvert.SerializeObject(x));
            }
            if (signUp.securityKey != secureKey)
            {
                string x = "Wrong Security Key entered";
                return(JsonConvert.SerializeObject(x));
            }
            bool confirm = ((u == null) && (signUp.securityKey == secureKey));

            if (confirm)
            {
                User k = new User();
                //new User();
                k.Email    = signUp.email;
                k.Password = signUp.password;
                // u.Password = IUserobj.Hash(signUp.password);
                k.FullName    = signUp.fullName;
                k.Designation = "SME";
                // Console.WriteLine(k);
                IUserobj.Register(k);
                string x = "Success";
                return(JsonConvert.SerializeObject(x));
            }
            else
            {
                string x = "some other case";
                return(JsonConvert.SerializeObject(x));
            }
        }
        public ActionResult SignUp([Bind(Exclude = "IsEmailVerified,ActivationCode,ProfilePicture")] signUp User)
        {
            bool Status  = false;
            bool Invalid = false;

            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("BadRequest", "Registration failed!");
            }
            else
            {
                signUp ob      = new signUp();
                string created = ob.Create(User);

                if (created == "exists")
                {
                    ModelState.AddModelError("EmailExist", "Email Already Exists!");
                }
                else if (created == "error")
                {
                    Invalid         = true;
                    ViewBag.Invalid = Invalid;
                    ModelState.AddModelError("BadRequest", "Registration failed!");
                }
                else
                {
                    int    i           = created.IndexOf(" ");
                    int    sizeOfCode  = created.Length - i - 1;
                    string passedEmail = created.Substring(0, i);
                    string passedCode  = created.Substring((i + 1), sizeOfCode);
                    SendVerificationLink(passedEmail, passedCode);
                    ModelState.AddModelError("Success", "Admin has been added successfully! Activation Code has been sent to his email id.");
                    Status         = true;
                    ViewBag.Status = Status;
                }
            }
            return(View(User));
        }
Exemple #10
0
        public void HandleSignUp(signUp signUp)
        {
            if (checkInput(signUp))
            {
                UserServiceSoapClient reader = new UserServiceSoapClient();
                User newuser = reader.setSignUp(signUp.txtUsername.Text, signUp.txtPassword.Password.ToString(), signUp.txtFullname.Text, 0);

                if (reader.checkTV(signUp.txtUsername.Text))
                {
                    if (reader.insertTV(newuser))
                    {
                        MessageBox.Show("Thêm thành công !");
                    }
                    else
                    {
                        MessageBox.Show("Thất bại");
                    }
                }
                else
                {
                    MessageBox.Show("Username bị trùng !");
                }
            }
        }
Exemple #11
0
        protected void btnSignUp_Click(object sender, EventArgs e)
        {
            if (!captcha.IsValid)
            {
                return;
            }

            HashHelpers hash  = new HashHelpers();
            signUp      _user = new signUp();


            string message = string.Empty;

            if (txtPassword.Text != txtRePassword.Text)
            {
                message            = "رمز عبورها با هم تطابق ندارند";
                lblMessage.Text    = message;
                lblMessage.Visible = true;
                return;
            }
            else
            {
                lblMessage.Visible = false;
            }

            string username = txtUsername.Text.Trim();
            string password = txtPassword.Text.Trim();
            string hashpass = hash.Encrypt(password);

            if (!string.IsNullOrEmpty(cmbRoleGroup.SelectedValue))
            {
                GroupName = cmbRoleGroup.Text.ToString();
            }

            string email = txtEmail.Text.Trim();

            string roleName = GroupName + "-" + username;

            var result = _user.UserSignUp(username, hashpass, email, roleName);


            if (result != null)
            {
                if (result.Active == false || result.Status == 2)
                {
                    //go to oher page that show verificatino code
                    //role exists and user exists but user not active
                    if (result.Status == 1)
                    {
                        // user exist and not verification yet
                        //MessageBoxSignup1.ShowMessage(btnSignUp, "شما قبلا اقدام به ثبت نام کرده اید ولی هنوز کد  تایید را ارسال ننمودید \n لطفا با اطلاعات قبلی وارد شوید", WebUtility.Controls.MessageBox.MessageType.info);
                        WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "alert_exist", "alert('شما قبلا اقدام به ثبت نام کرده اید ولی هنوز کد  تایید را ارسال ننمودید \n لطفا با اطلاعات قبلی وارد شوید');", true);
                    }

                    //WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "modal", "$('#modal_signUp').modal('hide');", true);
                    //WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "alert", "alert('salam');", true);
                    WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "modal", "$('#modal" + uscVerification.ModalId + " ').modal();", true);
                    WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "time", "timer" + uscVerification.ClientID + "();", true);


                    string verificationCode = "1234";

                    if (new tkv.Utility.WebConfigurationHelper().GetAppSettingValue("SendSMS") == "yes")
                    {
                        verificationCode = _user.GenerateRandomNo().ToString();
                        uscVerification.sendSms(username, verificationCode);
                    }

                    uscVerification.VerficationCode = verificationCode;
                    uscVerification.Username        = username;
                }
                else
                {
                    //go to login page

                    //MessageBoxSignup1.ShowMessage(btnSignUp, "لطفا از قسمت ورود استفاده نمائید. شما قبلا با موفقیت ثبت نام کرده اید ", WebUtility.Controls.MessageBox.MessageType.danger);
                    WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "alert", "alert('لطفا از قسمت ورود استفاده نمائید. شما قبلا با موفقیت ثبت نام کرده اید ');", true);
                    WebUtility.Helpers.RegisterHelpers.RegisterScript(btnSignUp, "modal_hide", "$('.modal').modal('hide');", true);
                }
            }
        }
 public IActionResult Login(signUp signup)
 {
     _db.Signup.Add(signup);
     _db.SaveChanges();
     return(View());
 }