csrfToken() is not working with html page? - api

I am having node js backened server and frontend is simple html file running as a spa server.
<h1>Hello World</h1>
<form action="http://localhost:3000/entry" method="POST">
<div>
<label for="message">Enter a message</label>
<input id="message" name="message" type="text" />
</div>
<input type="submit" value="Submit" />
<input type="hidden" name="_csrf" value="{{csrfToken()}}" />
</form>
But it is not working.

Related

Store Login Information Locally

I want to store login information in my local server, but don't know how. I currently have an index, login, and library page in my root folder, and want to redirect users to the library page after they confirm their emails via email.
<body>
<div class="container">
<div class="card">
<div class="inner-box" id="card">
<div class="flip-card-front">
<h2>LOGIN</h2>
<form action="/action_page.php" id="Client" name="client" method="post" netlify align="left">
<input type="email#" class="input-box" placeholder="Your Email ID" required>
<input type="password" class="input-box" placeholder="Password" required>
<button type="submit" class="submit-btn">Submit</button>
<input type="checkbox"><span>Remember Me</span>
</form>
<button type="button" class="btn" onclick="openRegister()">I'm New Here</button>
Forgot Password
</div>
<div class="flip-card-back">
<h2>REGISTER</h2>
<form action="/action_page.php" id="registrant" name="new-client" method="post" netlify align="left">
<input maxlength="40" type="text" class="input-box" placeholder="Your Full Name" required>
<input maxlength="15" type="text" class="input-box" placeholder="Your Email ID" required>
<input maxlength="30" type="password" class="input-box" placeholder="Make a Password" required>
<center><input type="radio" name="gender">Male
<input type="radio" name="gender">Female
<input type="radio" name="gender">Other<br> </center><br>
<input type="checkbox"><span>Remember Me</span><br>
<input type="checkbox"><span>Applying For Work</span><br>
<button type="submit" class="submit-btn">Submit</button>
I Have an account
Forgot Password
var card = document.getElementById("card");
function openRegister(){
card.style.transform = "rotateY(-180deg)";
}
function openLogin(){
card.style.transform = "rotateY(0deg)";
}
</script>
</body>

How to render form on button clic in Vue?

I have two registration forms ona a page, but I only want to render one by clicking on proper button: 'Contract Form' or 'Company Form'. Should I do it with v-if? In the code below I just copied few lines of the form.
<template>
<div>
<button #click="contract">UMOWA</button>
<button #click="company">FIRMA</button>
<div v-if="contract">
<form method="post" #submit.prevent="onSubmit">
<label for="firstname">IMIĘ</label>
<input id="firstname" v-model="firstName" type="text" required />
<label for="lastname">NAZWISKO</label>
<input id="lastname" v-model="lastName" type="text" required />
<button type="submit">Zarejestruj się</button>
</form>
</div>
<div v-if="company">
<form method="post" #submit.prevent="onSubmit">
<label for="firstname">IMIĘ</label>
<input id="firstname" v-model="firstName" type="text" required />
<label for="lastname">NAZWISKO</label>
<button type="submit">Zarejestruj się</button>
<input id="lastname" v-model="lastName" type="text" required />
<label for="email">ADRES E-MAIL</label>
<input id="email" v-model="email" type="text" required />
<button type="submit">Zarejestruj się</button>
</form>
</div>
</div>
</template>
Yes but you will need to add true in the buttons onclick:
<button #click="contract = true">UMOWA</button>
<button #click="company = true">FIRMA</button>

using Bootstrap3 form in laravel5.1

I am trying to make a form using bootstrap3 in laravel5.1 so that I can get values from user and store it on the database and want to redirect the same page.
here is the form part of my code --
<div class="row">
<form action="{{url('fastshops/menu')}} " method="post" role="form">
<legend>ADD NEW ITEM</legend>
<div class="form-group">
<label for=""></label>
<input type="text" class="form-control" name="ItemID" id="" placeholder="Item ID...">
<label for=""></label>
<input type="text" class="form-control" name="ItemName" id="" placeholder="Item Name...">
<label for=""></label>
<input type="text" class="form-control" name="SellPrice" id="" placeholder="Sell Price...">
<label for=""></label>
<input type="text" class="form-control" name="NetPrice" id="" placeholder="Net Price...">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
but this part action="{{url('fastshops/menu')}} is not working ! If I click on the submit button I am having TokenMismatchException ! please help me out.
thanks in advance.
add this
<input type="hidden" name="_token" value="{{Session::token()}}"/> or
<input type="hidden" name="_token" value="{{csrf_token()}}"/>
inside your form.
Laravel 5 automatically check for CSRF on all Post request for all the routes. Read the docs, they are pretty self explainatory

Amazon S3 - How to abort uploading a video

I am building an application in which a user can upload a video to Amazon S3. I am uploading the video through browser.
Here is my form for uploading:
<form action="FormAction" method="FormMethod" enctype="FormEnclosureType" >
<input id="file-upload-form-key" type="hidden" name="key" value="FileId" />
<input type="hidden" name="AWSAccessKeyId" value="AWSAccessKey" />
<input type="hidden" name="acl" value="Acl" />
<input id="file-upload-form-policy" type="hidden" name="policy" value="Base64EncodedPolicy" />
<input id="file-upload-form-signature" type="hidden" name="signature" value="Signature" />
<input id="file-upload-form-redirect-url" type="hidden" name="redirect" value="RedirectUrl" />
<div class="row">
<label for="Title" style="padding-right: 5px;">Title (optional) </label>
<input id="file-upload-form-title" type="text" name="x-ignore-Title" style="width: 200px;" />
</div>
<div class="row_clear"></div>
<div class="row">
<input id="file-upload-form-file" type="file" accept="video/*" name="file" size="100" id="file"/>
</div>
</form>
I want to implement a cancel button through which a user can abort the uploading. Any help on how this can be done ?
I found this LINK which is similar to my problem. But the solution they have provided is for aborting multipart upload. Also I am not sure if this works when you are directly uploading from the browser.

How to send the http get in Rebol to download an wordpress xml backup file?

I would like to use rebol to download an xml backup of my blog from
http://reboltutorial.com/wp-admin/export.php
the form is
<form action="" method="get">
<h3>Options</h3>
<table class="form-table">
<tr>
<th><label for="author">Restrict Author</label></th>
<td>
<select name="author" id="author">
<option value="all" selected="selected">All Authors</option>
<option value='1'>admin</option></select>
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="submit" class="button" value="Download Export File" />
<input type="hidden" name="download" value="true" />
</p>
</form>
I guess I would first need to log in http://reboltutorial.com/login/ and then what after ?
Any code example to do similar stuff (getting the cookie, ...) ?
<form name="loginform" id="loginform" action="" method="post">
<p>
<label>Username<br />
<input type="text" name="log" id="user_login" class="input" value="" size="20" /></label>
</p>
<p>
<label>Password<br />
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
</p>
<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> Remember Me</label></p>
<p class="submit">
<input type="hidden" name="post-from" id="post-from" value="page" />
<input type="hidden" name="action" id="action" value="login" />
<input type="submit" name="wp-submit" id="wp-submit" value="Log In" />
<input type="hidden" name="redirect_to" value="http://reboltutorial.com/wp-admin/" />
<input type="hidden" name="testcookie" value="1" />
</p>
</form>
Try this
http://rebol.wik.is/Protocols/Http