def secure_button_to(name, url='', **html_options): """ Create a button (like webhelpers.rails.urls.button_to) including a hidden authentication token field. """ id = authentication_token() button_html = _button_to(name, url, **html_options) return '%s\n%s</form>' % (button_html, content_tag('div', hidden_field(token_key, id), style='display:none;'))
def secure_form_remote_tag(**args): """Create a form tag (like webhelpers.rails.prototype.form_remote_tag) including a hidden authentication token field. """ id = authentication_token() form_html = form_remote_tag(**args) return '%s\n%s' % (form_html, content_tag('div', hidden_field(token_key, id), style='display: none;'))
def secure_button_to(name, url='', **html_options): """ Create a button (like webhelpers.rails.urls.button_to) including a hidden authentication token field. """ id = authentication_token() button_html = _button_to(name, url, **html_options) return '%s\n%s</form>' % ( button_html, content_tag('div', hidden_field(token_key, id), style='display:none;'))