I would challenge you not to have this in the view as it introduces a security concern. Try to override the controller