Fixes related to validation of 'asset' field while creating new device.

It also includes fix for the 'logout' option in the user menu.
Why not ``if asset:``?