public void ShowChallengeFields(ref ServerDataCapture[] challenge_text)
		{
			for ( int i = 0; i < challenge_text.Length; i++)
			{
				GUI.Label(challenge_text[i].label_area, challenge_text[i].label);
				string val = "";
				if ( challenge_text[i].passwordChar == string.Empty )
				    val = GUI.TextField (challenge_text[i].value_area, challenge_text[i].value);
				else
					val = GUI.PasswordField (challenge_text[i].value_area, challenge_text[i].value, challenge_text[i].passwordChar[0]);
				if (serverState.CompareState(WULServerState.None))
					challenge_text[i].value = val;
			}
		}
		public bool ValidateChallengeData(ref ServerDataCapture[] fields)
		{
			bool result = true;
			foreach(ServerDataCapture field in fields)
			{
				if (field.fieldType != eFieldType.Verify)
					result = field.ValidInput();
				else
					result = field.ValidInput( fields[ field.verify ] );
				
				if (!result)
					return false;
			}
			return true;
		}
示例#3
0
		public bool ValidInput (ServerDataCapture compare_with = null)
		{
			switch (fieldType)
			{
			case eFieldType.Required:
				if (value == string.Empty)
				{
					StatusMessage.Message = "Field " + label + " is required...";
					return false;
				}
				break;
						
			case eFieldType.RequiredEmail:
				if (value == string.Empty)
				{
					StatusMessage.Message = "Field " + label + " is required...";
					return false;
				}

				if (!IsValidEmailFormat(value))
				{
					StatusMessage.Message = "Invalid email address for field " + label;  
					return false;
				}
				break;
						
			case eFieldType.Email:
				if (value != string.Empty)
					if (!IsValidEmailFormat(value))
				{
					StatusMessage.Message = "Invalid email address for field " + label;  
					return false;
				}
				break;
						
			case eFieldType.Verify:
				if (verify >= 0)
				{
					if (value != compare_with.value)
					{
						StatusMessage.Message = label + " does not match field " + compare_with.label;
						return false;
					}
				}
				break;		
			}
			return true;
		}
		public cmlData ChallengeToCMLData(ref ServerDataCapture[] challenge_text, bool allow_empty)
		{
			cmlData fields = new cmlData();
			foreach (ServerDataCapture field in challenge_text)
				if (field.fieldType != eFieldType.Verify)
					if (field.value != "" || allow_empty)
						fields.Set( field.serverfield, field.value );

			return fields;
		}