I have been trying to make a bash script that will login to the web login form using curl and perform some actions later on using cookies saved. I tried previous methods of stackoverflow answers but nothing works in my case, help is much appreciated.
WebForm of Login:
<form id="session_new" novalidate="novalidate" class="formtastic user" action="/admin/login" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="authenticity_token" value="sometoken" />
<fieldset class="inputs">
<ol>
<li class="email input required autofocus stringish" id="user_email_input"><label for="user_email" class="label">Email<abbr title="required">*</abbr></label><input id="user_email" autofocus="autofocus" type="email" value="" name="user[email]" />
</li>
<li class="password input required stringish" id="user_password_input"><label for="user_password" class="label">Password<abbr title="required">*</abbr></label><input maxlength="128" id="user_password" type="password" name="user[password]" />
</li>
<li class="boolean input optional" id="user_remember_me_input"><input type="hidden" name="user[remember_me]" value="0" /><label for="user_remember_me" class=""><input type="checkbox" name="user[remember_me]" id="soc_user_remember_me" value="1" />Remember me</label>
</li>
</ol>
</fieldset>
<fieldset class="actions">
<ol>
<li class="action input_action " id="user_submit_action"><input type="submit" name="commit" value="Login" data-disable-with="Login" />
Here is the curl request i tried using ,
curl -d "user[email]=emailhere&user[password]=passwordhere&user[remember_me]=0&commit=Login" http://urlhere
But it didn't work,so i tired wget method,
wget --save-cookies cookies.txt --keep-session-cookies --post-data="user[email]=emailhere&user[password]=passwordhere&user[remember_me]=0&commit=Login" "http://urlhere
It didn't work either.