My phone stopped remembering wifi passwords!
There is most likely a problem with the phone's /efs/ss_data file. I think it's basically a key for decryption of your Wi-Fi passwords and other things in secure storage. 

Root is required for this fix. 

First we need to confirm it's a problem with secure storage. 


Install BuildProp Editor from Play Store 
Set ro.secure.storage=false
Reboot, setup Wi-Fi &amp; reboot again 


WiFi should now remember passwords if there was an issue with secure storage.

Now let's fix the secure storage issue since we know what's broken.


Set ro.secure.storage=true using  BuildProp Editor
Backup EFS using TWRP/CWM recovery
Delete ss_data in /efs using ES File Explorer in root mode
Reboot, setup Wi-Fi and reboot again


Your Wi-Fi passwords should be remembered now on any ROM/kernel, non rooted and without edits to build.props

Tested ON:
Samsung Galaxy S6 SM-G920T1 MetroPCS Variant on 5.1.1 build DOJC 

Note:
This may work on other devices that require setting ro.secure.storage=false in build.prop for Wi-Fi to remember passwords. I have seen users with Nexus devices experiencing this issue as well. 

SOURCE