Password reset implementation for CouchDB
const http = require('http')
const jsonBody = require('body/json')
const PasswordReset = require('couchdb-password-reset')
const Templates = reqiure('couchdb-password-reset/templates')
const htmlIndex = require('simple-html-index') | |
const BufferList = require('bl') | |
function createPage (title) { | |
const html = htmlIndex({ title }) | |
const htmlBuffer = html.pipe(BufferList()) | |
return function flush () { | |
// return htmlBuffer // works | |
return htmlBuffer.duplicate() // doesn't work (empty) |
worker_processes 1; | |
error_log logs/error.log; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
proxy_buffer_size 128k; | |
proxy_buffers 4 256k; | |
proxy_busy_buffers_size 256k; | |
sendfile on; |
const choo = require('choo') | |
const html = require('choo/html') | |
const app = choo() | |
let dispatch | |
const listen = (cb) => dispatch = cb | |
app.model({ | |
state: { foo: 'bar' }, |
app.router((route) => [ | |
route('/', Layout()), | |
route('/:phone', requireLogin(Layout(Chat))), | |
route('/login', Layout(Login)) | |
]) | |
function requireLogin (View) { | |
return function (state, prev, send) { | |
if (!state.user.name) send('user:requireLogin') | |
return View(state, prev, send) |
/* global emit */ | |
const TOKEN_LIFESPAN = 30 // seconds | |
module.exports = { | |
_id: '_design/users', | |
views: { | |
byEmail: { | |
map: function (doc) { | |
emit(doc.metadata.email) | |
} |
function ensureParams (...params) { | |
params.forEach((param) => assert(window[param], `${param} must be passed`)) | |
} |
####################### | |
# Toggle Proxy | |
# Usage: | |
# sudo ./proxy.sh on | |
# sudo ./proxy.sh off | |
####################### | |
NETWORK_SERVICE=Wi-Fi # The name of the device in "Network Settings" left-hand panel | |
networksetup -setwebproxystate $NETWORK_SERVICE $1 |
/* global setState, sendVerificationEmail, sendApprovalEmail, sendRejectNotification, isValidKey */ | |
const supervisors = [ | |
'[email protected]', | |
'[email protected]' | |
] | |
module.exports = { | |
name: 'Travel Request', | |
states: [ | |
{ |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<meta name="robots" content="NONE,NOARCHIVE"> | |
<title>AttributeError at /api/travel-request/</title> | |
<style type="text/css"> | |
html * { padding:0; margin:0; } | |
body * { padding:10px 20px; } |