예제 #1
0
 public TransactionalMailNotifier(ILogger <TransactionalMailNotifier> logger, IMessageQueue messageQueue, IMailConfigStorage mailConfigStorage, Settings settings, WorkspaceAppService workspaceAppService)
 {
     _logger                  = logger;
     _messageQueue            = messageQueue;
     _transactionalMailHelper = new TransactionalMailHelper(new SendGridService(), mailConfigStorage, workspaceAppService);
     _mailValidation          = new MailValidation(new Storage <SendTrackingEntity>(settings.TableStorageConnectionString, settings.MailTrackingTableName));
     _pubSlackAppQueueName    = AppSettings.PubSlackAppQueueName;
 }
예제 #2
0
파일: Form1.cs 프로젝트: Jorgereg98/Minimus
        private void button1_Click(object sender, EventArgs e)
        {
            var val1    = new MailValidation(new AtValidation(), textBox1.Text);
            var result1 = val1.Verification();

            var val2    = new MailValidation(new DomainValidation(), textBox1.Text);
            var result2 = val2.Verification();

            var user   = new User();
            var result = _service.Exist(textBox1.Text);

            if (result1 == false || result2 == false)
            {
                MessageBox.Show("Su correo no tiene el formato correcto.");
                textBox1.Text = "Email";
                textBox2.Text = "Password";
            }
            else if (result == "No existe")
            {
                textBox1.Text = "Email";
                textBox2.Text = "Password";

                MessageBox.Show("Cuenta no registrada, únete!");
            }
            else if (result == "Existe")
            {
                result = _service.Verify(textBox1.Text, textBox2.Text);

                if (result == "Incorrecto")
                {
                    textBox1.Text = "Email";
                    textBox2.Text = "Password";
                    MessageBox.Show("Contraseña incorrecta!");
                }
                if (result == "Correcto")
                {
                    textBox1.Text = "";
                    textBox2.Text = "";
                    MessageBox.Show("Bienvenido!");
                    label6.Visible        = false;
                    button7.Visible       = true;
                    dataGridView1.Visible = true;

                    signupVisible(false);
                    loginVisible(false);

                    loadData(comboBox1);
                }
            }
        }
예제 #3
0
 public static void ValidateMail(string mail)
 {
     if (mail != "")
     {
         if (MailValidation.ValidateMail(mail) == false)
         {
             Console.WriteLine("Try to enter a VALID eMail!");
             GetMail();
         }
     }
     else
     {
         GetMail();
     }
 }
예제 #4
0
파일: Form1.cs 프로젝트: Jorgereg98/Minimus
        private void button3_Click(object sender, EventArgs e)
        {
            /////////
            ///

            var val1    = new MailValidation(new AtValidation(), textBox3.Text);
            var result1 = val1.Verification();

            var val2    = new MailValidation(new DomainValidation(), textBox3.Text);
            var result2 = val2.Verification();

            var user   = new User();
            var result = _service.Exist(textBox3.Text);

            user.mail    = textBox3.Text;
            user.pasword = textBox4.Text;
            user.cities  = "";

            if (result1 == false || result2 == false)
            {
                MessageBox.Show("Su correo no tiene el formato correcto.");
                textBox3.Text = "Email";
                textBox4.Text = "Password";
            }
            else if (result == "No existe")
            {
                textBox3.Text = "Email";
                textBox4.Text = "Password";
                _service.AddUser(user);

                MessageBox.Show("Bienvenido!");
                signupVisible(false);
                loginVisible(false);
                label6.Visible        = false;
                button7.Visible       = true;
                dataGridView1.Visible = true;

                loadData(comboBox1);
            }
            else if (result == "Existe")
            {
                textBox3.Text = "Email";
                textBox4.Text = "Password";

                MessageBox.Show("Cuenta ya registrada.");
            }
        }
        public static Credentials Create(string mail, string password)
        {
            var credentials = new Credentials();

            if (!MailValidation.IsValid(mail))
            {
                throw UserException.InvalidMailException(mail);
            }

            if (!credentials.IsPasswordValid(password))
            {
                throw UserException.InvalidPasswordException(password);
            }

            credentials.Mail      = mail;
            credentials.Password  = password;
            credentials.HashedPwd = HashingEncryption.EncryptWithBCrypt(password);

            return(credentials);
        }
예제 #6
0
        protected void btnSendMail_Click(object sender, EventArgs e)
        {
            if (UserInfoBLL.GetUserCountByMail(txtMail.Text) == 1)
            {
                Modal.Show(this, "该邮箱已被注册");
                return;
            }
            ;
            Random random  = new Random();
            string msgCode = random.Next(0, 999999).ToString("000000");

            Session["msgCode"] = msgCode;
            txtMailReg.Text    = txtMail.Text;
            if (MailValidation.SendValidation(txtMail.Text, msgCode))
            {
                Modal.Show(this, "验证码发送成功");
            }
            else
            {
                Modal.Show(this, "验证码发送失败,请联系管理员");
            }
        }
        public void IsValid_Test(string mail, bool expectedIsValid)
        {
            var validationResult = MailValidation.IsValid(mail);

            Assert.AreEqual(expectedIsValid, validationResult);
        }