Coverage for gws-app/gws/plugin/model_widget/password/__init__.py: 0%
14 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Password widget.
3Text input that masks the typed characters, with an optional placeholder text
4and an optional button that reveals the password.
6Example::
8 fields+ {
9 name "password"
10 type "text"
11 widget { type "password" withShow true }
12 }
13"""
15import gws
16import gws.base.model.widget
19@gws.ext.config.modelWidget('password')
20class Config(gws.base.model.widget.Config):
21 """Password input with masked characters."""
23 placeholder: str = ''
24 """Hint text shown in the empty input."""
25 withShow: bool = False
26 """Show a button that reveals the typed password."""
29@gws.ext.props.modelWidget('password')
30class Props(gws.base.model.widget.Props):
31 placeholder: str
32 withShow: bool
35@gws.ext.object.modelWidget('password')
36class Object(gws.base.model.widget.Object):
37 """Password widget object."""
39 def props(self, user):
40 return gws.u.merge(
41 super().props(user),
42 placeholder=self.cfg('placeholder'),
43 withShow=self.cfg('withShow'),
44 )