예제 #1
0
 public bool AddNewUser(string username, string password, string verify)
 {
     try
     {
         if (!AdminCheck(adminToken))
         {
             panel.StringInput[SerialInputJoins.AddNewUserErrMsg].StringValue =
                 "You do not have sufficient access to perform this operation";
             return(false);
         }
         if (password != verify) // string comparison
         {
             panel.StringInput[SerialInputJoins.AddNewUserErrMsg].StringValue =
                 "Error: Password and Verify Password do not match";
             return(false);
         }
         if (Authentication.AddUserToSystem(ref adminToken, username, password))
         {
             return(true);
         }
         else
         {
             panel.StringInput[SerialInputJoins.AddNewUserErrMsg].StringValue =
                 String.Format("{0} could not be added to the system", username);
             return(false);
         }
     }
     catch (Exception e)
     {
         WriteError("AddNewUser", e, SerialInputJoins.AddNewUserErrMsg);
         return(false);
     }
     finally
     {
     }
 }