private void regBtn_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var form = new RegisterForm()
            {
                Name       = nameTb.Text.Trim(),
                Email      = emailTb.Text,
                Password   = pwdTb.Password,
                RePassword = rePwdTb.Password,
                Agree      = agreeTb.IsChecked == true
            };

            if (!form.Agree)
            {
                _ = new MessageDialog(Constants.GetString("login_agreement_error")).ShowAsync();
                return;
            }
            if (!form.VerifyEmail())
            {
                _ = new MessageDialog(Constants.GetString("login_email_error")).ShowAsync();
                return;
            }
            if (!form.VerifyPassword())
            {
                _ = new MessageDialog(Constants.GetString("login_pwd_error")).ShowAsync();
                return;
            }
            if (form.Password != form.RePassword)
            {
                _ = new MessageDialog(Constants.GetString("login_re_pwd_error")).ShowAsync();
                return;
            }
            _ = Register(form);
        }
Example #2
0
        private void sendBtn_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var isSend = findBox.Visibility == Visibility.Collapsed;
            var form   = new RegisterForm()
            {
                Email      = emailTb.Text,
                Code       = codeTb.Text,
                Password   = pwdTb.Password,
                RePassword = rePwdTb.Password
            };

            if (!form.VerifyEmail())
            {
                _ = new MessageDialog(Constants.GetString("login_email_error")).ShowAsync();
                return;
            }
            if (isSend)
            {
                _ = SendEmail(form.Email);
                return;
            }
            if (form.Code.Length < 4)
            {
                _ = new MessageDialog(Constants.GetString("login_code_error")).ShowAsync();
                return;
            }
            if (!form.VerifyPassword())
            {
                _ = new MessageDialog(Constants.GetString("login_pwd_error")).ShowAsync();
                return;
            }
            if (form.Password != form.RePassword)
            {
                _ = new MessageDialog(Constants.GetString("login_re_pwd_error")).ShowAsync();
                return;
            }
            _ = ResetPassword(form);
        }