Exemple #1
0
 private void commitAction(string userID, string password)
 {
     if (pageMode == PageFunctions.LogIn && SSOCheckBox.IsChecked == true && LoginFunctions.SingleSignon(userID))
     {
         pageSuccess = true;
     }
     else if (!LoginFunctions.CheckPassword(userID, password))
     {
         MessageFunctions.InvalidMessage("Incorrect existing username or password. Please check and try again.", "Incorrect Login");
     }
     else if (pageMode == PageFunctions.LogIn)
     {
         LoginFunctions.AttemptLogin(userID, password);
         pageSuccess = true;
     }
     else if (pageMode == PageFunctions.PassChange)
     {
         bool success = LoginFunctions.ChangeLoginDetails(Globals.MyStaffID, userID, NewPassword.Password, ConfirmPassword.Password);
         if (success)
         {
             MessageFunctions.SuccessAlert("Your password has been changed successfully.", "Password Changed");
             pageSuccess = true;
         }
     }
 }
Exemple #2
0
 private void completeAction()
 {
     if (pageSuccess)
     {
         LoginFunctions.CompleteLogIn();
     }
     toggleWaitMessage(false);
 }
Exemple #3
0
        private void loadContent()
        {
            CapsLockLabel.Visibility = Visibility.Hidden;
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            if (pageMode == PageFunctions.LogIn)
            {
                try
                {
                    ssoID  = LoginFunctions.SingleSignonID();
                    canSSO = (ssoID != "");
                    if (Globals.MyStaffID > 0)    // already logged in, aiming to change login
                    {
                        PageHeader.Content = "Log In as a Different User";
                        if (canSSO && ssoID != Globals.MyUserID)
                        {
                            Welcome.Content       = "Please use single sign-on or enter a UserID and password to change your login.";
                            SSOCheckBox.IsChecked = true;
                        }
                        else
                        {
                            Welcome.Content          = "Please enter a UserID and password to change your login.";
                            SSOCheckBox.IsChecked    = false;
                            SSOCheckBox.IsEnabled    = false;
                            PasswordLabel.Visibility = Password.Visibility = Visibility.Visible;
                        }
                        RightHeader.Visibility = Visibility.Hidden;
                    }
                    else if (canSSO)
                    {
                        SSOCheckBox.IsChecked = true;
                        Welcome.Content       = "Please log in via single sign-on, or un-check the 'Single Sign-on' option and enter a UserID and password.";
                        MessageFunctions.InfoAlert("Please log in to the system.", "Welcome to ProjectTile");
                    }
                    else
                    {
                        SSOCheckBox.IsEnabled    = false;
                        PasswordLabel.Visibility = Password.Visibility = Visibility.Visible;
                        MessageFunctions.InfoAlert("Please enter your login credentials.", "Welcome to ProjectTile");
                    }
                }
                catch (Exception generalException) { MessageFunctions.Error("Error setting initial login view", generalException); }
            }
            else if (pageMode == PageFunctions.PassChange)
            {
                try
                {
                    PasswordLabel.Visibility = Password.Visibility = Visibility.Visible;
                    NewPassword.Visibility   = NewPasswordLabel.Visibility = ConfirmPassword.Visibility = ConfirmLabel.Visibility = Visibility.Visible;
                    NewPasswordLabel.Margin  = SSOLabel.Margin;
                    NewPassword.Margin       = SSOCheckBox.Margin;
                    CommitButtonText.Text    = "Change";
                    PageHeader.Content       = "Change Your ProjectTile Password";
                    HeaderImage2.SetResourceReference(Image.SourceProperty, "PasswordIcon");
                    Welcome.Content         = "Please enter your existing password, and your new password twice.";
                    UserID.IsEnabled        = false;
                    UserID.Text             = Globals.MyUserID;
                    RightHeader.Visibility  = Visibility.Hidden;
                    PleaseWaitLabel.Content =
                        SSOLabel.Visibility = SSOCheckBox.Visibility = Visibility.Hidden;
                    if (LoginFunctions.HasSingleSignon(Globals.MyUserID))
                    {
                        SSONote.Text = "Note that your account currently has Single Sign-on, which allows direct login (without entering a password) when logged into the "
                                       + "operating system as yourself, so a ProjectTile password is not normally required.";
                    }
                }
                catch (Exception generalException)
                {
                    MessageFunctions.Error("Error setting screen components", generalException);
                    PageFunctions.ShowTilesPage();
                }
            }
        }