bug to authenticate with invalid username

When username not found, record variable not have id attribute