Example #1
0
        public override bool ValidateUser(
            string username, string password)
        {
            bool result = PTPrincipal.Login(username, password);

            return(result);
        }
Example #2
0
        void btnLogout_Click(object sender, EventArgs e)
        {
            PTPrincipal.Logout();

            StartActivity(typeof(Welcome));
            this.Finish();
        }
Example #3
0
 private void OK_Click(object sender, EventArgs e)
 {
     try
     {
         PTPrincipal.Login(this.txtUserID.Text, this.txtPassword.Text);
         this.Close();
     }
     catch (Dothan.DataPortalException ex)
     {
         if (ex.BusinessException is SqlException)
         {
             Util.ErrorLogging(Resources.SqlError, ex.BusinessException.ToString(), "Error");
         }
         else
         {
             MessageBox.Show(Resources.LoginErrorMessage, Resources.LoginErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Question);
         }
     }
     finally
     {
         this.txtUserID.Text   = "";
         this.txtPassword.Text = "";
         this.txtUserID.Focus();
     }
 }
Example #4
0
    public override bool ValidateUser(string username, string password)
    {
        bool result = PTPrincipal.Login(username, password);

        HttpContext.Current.Session["DothanPrincipal"] = Dothan.ApplicationContext.User;

        return(result);
    }
Example #5
0
        public async void LoginUser()
        {
            Bxf.Shell.Instance.ShowStatus(new Bxf.Status {
                IsBusy = true, Text = "Validating credentials..."
            });
            await PTPrincipal.LoginAsync(Username, Password);

            Bxf.Shell.Instance.ShowView(null, "Main");
        }
 private static bool SetPrincipal(PTIdentity identity)
 {
     if (identity.IsAuthenticated)
     {
         PTPrincipal principal = new PTPrincipal(identity);
         Csla.ApplicationContext.User = principal;
     }
     return identity.IsAuthenticated;
 }
Example #7
0
        public void WithInvalidRole()
        {
            // Authenticate into the current context
            PTPrincipal.Login(Constants.User.ValidUsername, Constants.User.ValidPassword);

            // Now get the principal off the current context
            IPrincipal principal = Csla.ApplicationContext.User;
            bool       isInRole  = principal.IsInRole(Constants.Role.InvalidRole);

            Assert.IsFalse(isInRole);
        }
Example #8
0
        //int count = 1;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Csla.DataPortal.ProxyTypeName             = typeof(Csla.DataPortalClient.WcfProxy).AssemblyQualifiedName;
            Csla.DataPortalClient.WcfProxy.DefaultUrl = Resources.GetString(Resource.String.DataPortalURL);

            // Set the CSLA.ApplicationContext.User
            PTPrincipal.Logout();

            StartActivity(typeof(Welcome));
        }
Example #9
0
File: Login.cs Project: wyerp/csla
 public async Task LoginUserAsync()
 {
     this.IsBusy = true;
     try
     {
         await PTPrincipal.LoginAsync(UserName, Password);
     }
     finally
     {
         this.IsBusy = false;
     }
 }
Example #10
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                bool result = PTPrincipal.Login(model.UserName, model.Password);
                var  user   = new MvcUI.Models.PTApplicationUser((ProjectTracker.Library.Security.PTIdentity)Csla.ApplicationContext.User.Identity);
                if (result && user != null)
                {
                    await SignInAsync(user, model.RememberMe);

                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username or password.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Example #11
0
 public void TearDown()
 {
     PTPrincipal.Logout();
 }
Example #12
0
        public void SetUp()
        {
            bool isAuthenticated = PTPrincipal.Login(Username, Password);

            Assert.IsTrue(isAuthenticated);
        }
Example #13
0
        public void InvalidUsernameInvalidPassword()
        {
            bool isAuthenticated = PTPrincipal.Login(Constants.User.InvalidUsername, Constants.User.InvalidPassword);

            Assert.IsFalse(isAuthenticated);
        }
Example #14
0
        public void ValidUsernameValidPassword()
        {
            bool isAuthenticated = PTPrincipal.Login(Constants.User.ValidUsername, Constants.User.ValidPassword);

            Assert.IsTrue(isAuthenticated);
        }
 public static void Logout()
 {
     PTIdentity identity = PTIdentity.UnauthenticatedIdentity();
     PTPrincipal principal = new PTPrincipal(identity);
     Csla.ApplicationContext.User = principal;
 }