mirror of
				https://github.com/s00500/ESPUI.git
				synced 2025-11-04 04:13:23 +00:00 
			
		
		
		
	Added variant of the text type to support hidden password fields
This commit is contained in:
		@@ -59,16 +59,17 @@ void Control::DeleteControl()
 | 
				
			|||||||
void Control::MarshalControl(JsonObject & item, bool refresh)
 | 
					void Control::MarshalControl(JsonObject & item, bool refresh)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    item[F("id")]      = id;
 | 
					    item[F("id")]      = id;
 | 
				
			||||||
 | 
					    ControlType TempType = (ControlType::Password == type) ? ControlType::Text : type;
 | 
				
			||||||
    if(refresh)
 | 
					    if(refresh)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        item[F("type")] = uint32_t(type) + uint32_t(ControlType::UpdateOffset);
 | 
					        item[F("type")] = uint32_t(TempType) + uint32_t(ControlType::UpdateOffset);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        item[F("type")] = uint32_t(type);
 | 
					        item[F("type")] = uint32_t(TempType);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    item[F("label")]   = label;
 | 
					    item[F("label")]   = label;
 | 
				
			||||||
    item[F("value")]   = value;
 | 
					    item[F ("value")]   = (ControlType::Password == type) ? F ("--------") : value;
 | 
				
			||||||
    item[F("visible")] = visible;
 | 
					    item[F("visible")] = visible;
 | 
				
			||||||
    item[F("color")]   = (int)color;
 | 
					    item[F("color")]   = (int)color;
 | 
				
			||||||
    item[F("enabled")] = enabled;
 | 
					    item[F("enabled")] = enabled;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,7 @@ enum ControlType : uint8_t
 | 
				
			|||||||
    Separator,
 | 
					    Separator,
 | 
				
			||||||
    Time,
 | 
					    Time,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Password = 99,
 | 
				
			||||||
    UpdateOffset = 100,
 | 
					    UpdateOffset = 100,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user