passwords-dialog: refactor copy popup code