Store credentials only in session if required

Fixes:
- https://github.com/owncloud/core/issues/7199
Ok, didn't notice this was against stable7