Пример #1
0
        private void Resetpwd_Clicked(object sender, EventArgs e)
        {
            var userid   = txtuname.Text;
            var password = txtpass.Text;

            frmfaild.IsVisible   = false;
            frmsuccess.IsVisible = false;
            errorframe.IsVisible = false;

            if ((string.IsNullOrEmpty(userid)) || (string.IsNullOrEmpty(password)))
            {
                lblmsg.Text          = "All fields are required for registration.";
                errorframe.IsVisible = true;
                lblmsg.IsVisible     = true;
                return;
            }
            //if (Convert.ToString(password).Length < 7)
            //{
            //    lblmsg.Text = "Password did not pass our security criteria. Please try another password. Hint: No space, Certain special characters are not allowed.";
            //    return;
            //}

            if ((SecurityCheck.isTampered((Convert.ToString(password) == null ? "" : password))) || (Convert.ToString(password).Length < 7))
            {
                lblmsg.Text          = "Password did not pass our security criteria. Hint: Needs to be minimum 6 chars long, No Spaces, certain special characters are not allowed.";
                errorframe.IsVisible = true;
                lblmsg.IsVisible     = true;
                return;
            }

            var InviteCode = App.SqlLiteCon().Query <Customer>("SELECT * FROM Customer WHERE UserId = ?", userid).Count > 0 ? App.SqlLiteCon().Query <Customer>("SELECT * FROM Customer WHERE UserId = ?", userid)[0].XCode : "";

            // var res = App.SOAP_Request.ValidateLogins(userid.Trim(), TripleDES.Encrypt(password.Trim()), InviteCode.Trim());


            var rsds = App.SOAP_Request.ForgotPassword(userid.Trim(), TripleDES.Encrypt(password.Trim()), InviteCode.Trim());

            if (rsds.ToLower().Contains("success"))
            {
                frmsuccess.IsVisible = true;
                login.IsVisible      = false;
            }
            else
            {
                frmfaild.IsVisible = true;
                login.IsVisible    = false;
            }
        }
Пример #2
0
        private async void CreateAccount_Clicked(object sender, EventArgs e)
        {
            try
            {
                var userid     = txtuname.Text.Trim();
                var password   = txtpass.Text.Trim();
                var InviteCode = txtinvitecode.Text.Trim();
                var BackgroundLocationUpdate = "";

                if ((string.IsNullOrEmpty(txtuname.Text)) || (string.IsNullOrEmpty(txtpass.Text)) || (string.IsNullOrEmpty(txtinvitecode.Text)))
                {
                    lblmsg2.Text         = "All fields are required for registration.";
                    lblmsg2.IsVisible    = true;
                    errorframe.IsVisible = true;
                    return;
                }
                if ((SecurityCheck.isTampered((Convert.ToString(txtpass.Text) == null ? "" : txtpass.Text))) || (Convert.ToString(txtpass.Text).Length < 7))
                {
                    lblmsg2.Text         = "Password did not pass our security criteria. Hint: Needs to be minimum 6 chars long, No Spaces, certain special characters are not allowed.";
                    lblmsg2.IsVisible    = true;
                    errorframe.IsVisible = true;
                    return;
                }



                var rsds = App.SOAP_Request.NewRegistration(userid.Trim(), TripleDES.Encrypt(password.Trim()), InviteCode.Trim(), BackgroundLocationUpdate);



                if (!rsds.Contains("\"CompanyID\":"))
                {
                    lblmsg2.Text         = rsds;
                    lblmsg2.IsVisible    = true;
                    errorframe.IsVisible = true;
                    return;
                }
                Re_Type response = null;
                try
                {
                    response = JsonConvert.DeserializeObject <Re_Type>(rsds);
                    BackgroundLocationUpdate = response.BackgroundLocationUpdate;
                }
                catch (Exception f)
                {
                    lblmsg2.Text         = f.Message;
                    lblmsg2.IsVisible    = true;
                    errorframe.IsVisible = true;
                    return;
                }

                if (response.Valid.ToString().ToLower() == "y")
                {
                    Customer custom = new Customer();
                    custom.UserId                     = userid;
                    custom.Password                   = password;
                    custom.XCode                      = InviteCode;
                    custom.Type                       = response.Type != null ? response.Type : "";
                    custom.CompanyID                  = response.Type != null ? response.CompanyID : "";
                    custom.TransactURL                = response.Type != null ? response.URL : "";
                    custom.ActiveShipmentNo           = "";
                    custom.ActiveShipmentStatus       = "";
                    custom.LocationUpdate             = BackgroundLocationUpdate;
                    custom.IsBackgroundLocationUpdate = "";
                    App.SqlLiteCon().CreateTable <Customer>();

                    App.SqlLiteCon().Insert(custom);

                    if (App.SqlLiteCon().Table <Customer>().Count() == 0)
                    {
                        lblmsg2.Text         = "Invite Code Not Stored.";
                        lblmsg2.IsVisible    = true;
                        errorframe.IsVisible = true;
                        return;
                    }

                    await DisplayAlert("", "Registered Successfully.", "OK");

                    await Navigation.PushAsync(new MainPage());
                }
                else
                {
                    lblmsg2.Text         = "User's registration is not accepted, please contact admin.";
                    lblmsg2.IsVisible    = true;
                    errorframe.IsVisible = true;
                    return;
                }
            }
            catch (Exception ex)
            {
                lblmsg2.Text         = ex.Message.ToString();
                lblmsg2.IsVisible    = true;
                errorframe.IsVisible = true;
            }
        }