Repository: netbox-community/netbox

Issue:
Hide WIFI password
### NetBox version

v3.4.3

### Feature type

Change to existing functionality

### Proposed functionality

Is it possible to hide the WIFI password as well? As now when you add the password it is added as plain-text.
Can this be a hidden password with "*********" and icon on the side to make it visible?

Or does it needs to be moved to "secret(store) plugin?



### Use case

Well i think passwords dont need to be visible until you want it to be. 
The best part is that you ofcourse need to be logged in to see this. 
But some think this needs to be secure and im not sure if this is also plain text in the database itself? 

### Database changes

Probally yes encrypted and hidden

### External dependencies

Maybe the secret plugin.


Discussion:
I extended the original secretstore plugin to allow to be used with any object in NetBox. You can check it at https://github.com/Onemind-Services-LLC/netbox-secrets if this resolves the issue
It would definitely be quite the undertaking to re-implement reversible encryption in the database for this field. However a UI change to _hide_ and _show_ the password [should be fairly easy to do](https://www.w3schools.com/howto/howto_js_toggle_password.asp).
> I extended the original secretstore plugin to allow to be used with any object in NetBox. You can check it at https://github.com/Onemind-Services-LLC/netbox-secrets if this resolves the issue

I need to look into that. Youu need additional config in plugin_config right?
> It would definitely be quite the undertaking to re-implement reversible encryption in the database for this field. However a UI change to _hide_ and _show_ the password [should be fairly easy to do](https://www.w3schools.com/howto/howto_js_toggle_password.asp).

That could be a valid in between solution yes
> > I extended the original secretstore plugin to allow to be used with any object in NetBox. You can check it at https://github.com/Onemind-Services-LLC/netbox-secrets if this resolves the issue
> 
> I need to look into that. Youu need additional config in plugin_config right?

Yes, you need to configure the `apps` to which the secrets should be applied. To provide some backwards compatibility, the defaults are device and virtual machine. You can provide any object from NetBox as the list of options and it'll work from there including the API calls.
I'm going to mark this as open for volunteers with the understanding that the scope of the FR is merely to toggle visibility of the field value in the user interface, and does not encompass any form of encryption or other obfuscation.
I forgot to respond to the solutions that @abhi1693 also provided with secrets plugin. 
My workaround for that was to place a comment in the PSK with remark to "See Secrets". Because with the plugin it provide a new view (Secrets) inside the WIFI but that works ok. 

Dont know if the option is to inject the secrets, the create WPA-PSK field in the provided field from netbox from the plugin?
But then again you also have a dependency from the plugin.

Only for those that dont use a plugin the toggle ofcourse helps
I'd like to pickup this FR if it still available
@jacobpfickes are you still interested in working on this?
@jeremystretch sorry for the late reply. My laptop actually broke so I need to save up for a new one. Feel free to release this or assign to someone else for now.
I'll take this one

Resolving patch:
diff --git a/netbox/wireless/forms/model_forms.py b/netbox/wireless/forms/model_forms.py
--- a/netbox/wireless/forms/model_forms.py
+++ b/netbox/wireless/forms/model_forms.py
@@ -1,3 +1,4 @@
+from django.forms import PasswordInput
 from django.utils.translation import gettext as _
 from dcim.models import Device, Interface, Location, Region, Site, SiteGroup
 from ipam.models import VLAN, VLANGroup
@@ -101,6 +102,10 @@ class Meta:
             'status': StaticSelect,
             'auth_type': StaticSelect,
             'auth_cipher': StaticSelect,
+            'auth_psk': PasswordInput(
+                render_value=True,
+                attrs={'data-toggle': 'password'}
+            ),
         }
 
 
@@ -206,6 +211,10 @@ class Meta:
             'status': StaticSelect,
             'auth_type': StaticSelect,
             'auth_cipher': StaticSelect,
+            'auth_psk': PasswordInput(
+                render_value=True,
+                attrs={'data-toggle': 'password'}
+            ),
         }
         labels = {
             'auth_type': 'Type',


Test patch: