Fixed bug "User role is reset upon login"

Please merge the changes.