Email Login

This commit is contained in:
Georg Reisinger
2019-02-24 19:27:42 +01:00
parent f853a2bf0f
commit 3baf79e8f6
39 changed files with 3246 additions and 2982 deletions

View File

@ -9,26 +9,30 @@ var greenlock = require('../').create({
// Let's Encrypt v2 is ACME draft 11
// Note: If at first you don't succeed, stop and switch to staging
// https://acme-staging-v02.api.letsencrypt.org/directory
server: 'https://acme-v02.api.letsencrypt.org/directory'
, version: 'draft-11'
// You MUST have write access to save certs
, configDir: '~/.config/acme/'
server: 'https://acme-v02.api.letsencrypt.org/directory',
version: 'draft-11'
// You MUST have write access to save certs
,
configDir: '~/.config/acme/'
// The previous 'simple' example set these values statically,
// but this example uses approveDomains() to set them dynamically
//, email: 'none@see.note.above'
//, agreeTos: false
// The previous 'simple' example set these values statically,
// but this example uses approveDomains() to set them dynamically
//, email: 'none@see.note.above'
//, agreeTos: false
// approveDomains is the right place to check a database for
// email addresses with domains and agreements and such
, approveDomains: approveDomains
// approveDomains is the right place to check a database for
// email addresses with domains and agreements and such
,
approveDomains: approveDomains
, app: require('./my-express-app.js')
,
app: require('./my-express-app.js')
// Get notified of important updates and help me make greenlock better
, communityMember: true
// Get notified of important updates and help me make greenlock better
,
communityMember: true
//, debug: true
//, debug: true
});
@ -52,7 +56,10 @@ function approveDomains(opts, certs, cb) {
}
fooCheckDb(opts.domains, function (err, agree, email) {
if (err) { cb(err); return; }
if (err) {
cb(err);
return;
}
// Services SHOULD automatically accept the ToS and use YOUR email
// Clients MUST NOT accept the ToS without asking the user
@ -64,7 +71,10 @@ function approveDomains(opts, certs, cb) {
// opts.challengeType = 'http-01';
// opts.challenge = require('le-challenge-fs').create({});
cb(null, { options: opts, certs: certs });
cb(null, {
options: opts,
certs: certs
});
});
}
@ -75,7 +85,7 @@ function approveDomains(opts, certs, cb) {
function fooCheckDb(domains, cb) {
// This is an oversimplified example of how we might implement a check in
// our database if we have different rules for different users and domains
var domains = [ 'example.com', 'www.example.com' ];
var domains = ['example.com', 'www.example.com'];
var userEmail = 'john.doe@example.com';
var userAgrees = true;
var passCheck = opts.domains.every(function (domain) {
@ -87,4 +97,4 @@ function fooCheckDb(domains, cb) {
} else {
cb(null, userAgrees, userEmail);
}
}
}