Jump to content

Invalid security token on post


vdonadio

Recommended Posts

Hi all,

I created a carrier module, it's not my first one. In the configuration page, I have a form with many fields, it's actually really basic

Configure.tpl

<script src="/modules/pickit/views/js/back.js"></script>

<section class="clearfix">
	<div class="row decidir-header">
		<div class="col-xs-6 col-md-4 text-center">
			<h4>Credenciales de proveedores</h4>
		</div>
	</div>

	<hr />
	
	<div class="pickit-content">
		<div class="row">
			<div class="form-group">
				<div class="col-md-2">
					<label>Proveedor</label>
				</div>
				
				<div class="col-md-3">
					<label>API KEY: </label>
				</div>
				
				<div class="col-md-3">
					<label>TOKEN: </label>
				</div>
				
				<div class="col-md-3">
					<label>URL Servicios: </label>
				</div>
			</div>
			<form action='' method='post'>
			{foreach from=$suppliers item=supplier}
				<div class="form-group">
					<label class="col-md-2">
						{$supplier.name}
					</label>
					
					<label class="col-md-3">
						<input type='text' name='api_key[{$supplier.id_supplier}]' id='api_key_{$supplier.id_supplier}' class='mdl-textfield__input' value="{if 'credentials'|array_key_exists:$supplier}{$supplier.credentials.api_key}{/if}"/>
					</label>
					
					<label class="col-md-3">
						<input type='text' name='token[{$supplier.id_supplier}]' id='token_{$supplier.id_supplier}' class='mdl-textfield__input' value="{if 'credentials'|array_key_exists:$supplier}{$supplier.credentials.token}{/if}"/>
					</label>
					
					<label class="col-md-3">
						<input type='text' name='webservice_url[{$supplier.id_supplier}]' id='webservice_url_{$supplier.id_supplier}' class='mdl-textfield__input' value="{if 'credentials'|array_key_exists:$supplier}{$supplier.credentials.webservice_url}{/if}"/>
					</label>
				</div>
			{/foreach}
				<input type='hidden' name='saveCredentials' value='1'/>
				<label class="col-md-2">
					<input type='submit' class='btn tbn-flat btn-info' value="Guaradar"/>
				</label>
			</form>
		</div>

		<hr />
		
		<div class="row">
			<div class="col-md-12">
				<div class="row">
				</div>
			</div>
		</div>
	</div>
</section>

 

When I get into this configuration page, everithing works fine, but when I click on submit, I get the error of "Invalid security token"
The funny thing is that, as you can see, I'm posting to the same page where I am - Which is catched by an admin controller inside this module. Same parameters, same token.

Any ideas? I'm really stucked

Prestashop 1.6.1.4
 

Edited by vdonadio (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...