Fix T38640: password values showed in tooltips
also disable copying password text.
This commit is contained in:
parent
01d9bbaa5e
commit
2413b444d0
Notes:
blender-bot
2023-02-14 11:11:02 +01:00
Referenced by issue #38640, StringProperty(subtype='PASSWORD') shows value in tooltip
|
@ -1677,6 +1677,13 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
|
|||
return;
|
||||
}
|
||||
|
||||
if (mode == 'c') {
|
||||
/* disallow copying from any passwords */
|
||||
if (but->rnaprop && (RNA_property_subtype(but->rnaprop) == PROP_PASSWORD)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == 'v') {
|
||||
/* extract first line from clipboard in case of multi-line copies */
|
||||
int pbuf_len;
|
||||
|
|
|
@ -325,12 +325,15 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
|||
}
|
||||
|
||||
if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) {
|
||||
/* full string */
|
||||
ui_get_but_string(but, buf, sizeof(buf));
|
||||
if (buf[0]) {
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf);
|
||||
data->color_id[data->totline] = UI_TIP_LC_NORMAL;
|
||||
data->totline++;
|
||||
/* better not show the value of a password */
|
||||
if ((but->rnaprop && (RNA_property_subtype(but->rnaprop) == PROP_PASSWORD)) == 0) {
|
||||
/* full string */
|
||||
ui_get_but_string(but, buf, sizeof(buf));
|
||||
if (buf[0]) {
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf);
|
||||
data->color_id[data->totline] = UI_TIP_LC_NORMAL;
|
||||
data->totline++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue