Skip to content

Commit 330e128

Browse files
committed
feat: copy from lad.sh
1 parent 6483dd5 commit 330e128

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4588
-3553
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,36 @@
2323
"Nick Baugh <[email protected]> (http://niftylettuce.com)"
2424
],
2525
"dependencies": {
26-
"cac": "^6.5.2",
26+
"cac": "^6.5.3",
2727
"camelcase": "^5.3.1",
2828
"github-username-regex": "^1.0.0",
2929
"is-email": "^1.0.0",
3030
"is-url": "^1.2.4",
3131
"is-valid-npm-name": "^0.0.4",
3232
"npm-conf": "^1.1.3",
33-
"sao": "0.22.17",
33+
"sao": "0.x",
3434
"semver": "^6.3.0",
3535
"speakingurl": "^14.0.1",
3636
"superb": "^4.0.0",
3737
"update-notifier": "^3.0.1",
3838
"uppercamelcase": "^3.0.0"
3939
},
4040
"devDependencies": {
41-
"@commitlint/cli": "^8.1.0",
42-
"@commitlint/config-conventional": "^8.1.0",
43-
"ava": "^2.3.0",
44-
"codecov": "^3.5.0",
45-
"cross-env": "^5.2.1",
46-
"eslint": "^6.3.0",
41+
"@commitlint/cli": "^8.2.0",
42+
"@commitlint/config-conventional": "^8.2.0",
43+
"ava": "^2.4.0",
44+
"codecov": "^3.6.1",
45+
"cross-env": "^6.0.3",
46+
"eslint": "^6.7.2",
4747
"eslint-config-xo-lass": "^1.0.3",
4848
"eslint-plugin-compat": "^3.3.0",
49-
"husky": "^3.0.5",
50-
"lint-staged": "^9.2.5",
49+
"husky": "^3.1.0",
50+
"lint-staged": "^9.5.0",
5151
"nyc": "^14.1.1",
52-
"remark-cli": "^7.0.0",
52+
"remark-cli": "^7.0.1",
5353
"remark-preset-github": "^0.0.16",
5454
"supertest": "^4.0.2",
55-
"xo": "^0.24.0"
55+
"xo": "^0.25.3"
5656
},
5757
"engines": {
5858
"node": ">=8.9.0"

template/.env.defaults

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ API_SSL_CERT_PATH=
3535
APP_NAME=Lad
3636
APP_COLOR=#94CC27
3737
TWITTER=@niftylettuce
38+
TRANSPORT_DEBUG=false
3839
SEND_EMAIL=false
3940
4041
SHOW_STACK=true
42+
SHOW_META=true
4143
SUPPORT_REQUEST_MAX_LENGTH=500
4244
# @ladjs/i18n
4345
I18N_SYNC_FILES=true
@@ -57,8 +59,12 @@ AUTH_STRIPE_ENABLED=false
5759
GOOGLE_CLIENT_ID=
5860
GOOGLE_CLIENT_SECRET=
5961
GOOGLE_CALLBACK_URL={{{WEB_URL}}}/auth/google/ok
60-
# used by `mandarin` translation package
61-
GOOGLE_TRANSLATE_KEY=
62+
GOOGLE_APPLICATION_CREDENTIALS=
63+
# your github client ID and secret from:
64+
# https://github.com/settings/applications
65+
GITHUB_CLIENT_ID=
66+
GITHUB_CLIENT_SECRET=
67+
GITHUB_CALLBACK_URL={{{WEB_URL}}}/auth/github/ok
6268
# your Postmark token from:
6369
# https//postmarkapp.com
6470
POSTMARK_API_TOKEN=
@@ -104,3 +110,9 @@ BULL_REDIS_PASSWORD=
104110
#############
105111
CERTBOT_WELL_KNOWN_NAME=
106112
CERTBOT_WELL_KNOWN_CONTENTS=
113+
114+
######################
115+
## verification pin ##
116+
######################
117+
VERIFICATION_PIN_TIMEOUT_MS=5m
118+
VERIFICATION_PIN_EMAIL_INTERVAL_MS=1m

template/.env.schema

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ APP_NAME=
3636
APP_COLOR=
3737
TWITTER=
3838
SEND_EMAIL=
39+
TRANSPORT_DEBUG=
3940
EMAIL_DEFAULT_FROM=
4041
SHOW_STACK=
42+
SHOW_META=
4143
SUPPORT_REQUEST_MAX_LENGTH=
4244
# @ladjs/i18n
4345
I18N_SYNC_FILES=
@@ -57,8 +59,12 @@ AUTH_STRIPE_ENABLED=
5759
GOOGLE_CLIENT_ID=
5860
GOOGLE_CLIENT_SECRET=
5961
GOOGLE_CALLBACK_URL=
60-
# used by `mandarain` translation package
61-
GOOGLE_TRANSLATE_KEY=
62+
GOOGLE_APPLICATION_CREDENTIALS=
63+
# your github client ID and secret from:
64+
# https://github.com/settings/applications
65+
GITHUB_CLIENT_ID=
66+
GITHUB_CLIENT_SECRET=
67+
GITHUB_CALLBACK_URL=
6268
# your Postmark token from:
6369
# https//postmarkapp.com
6470
POSTMARK_API_TOKEN=
@@ -104,3 +110,9 @@ BULL_REDIS_PASSWORD=
104110
#############
105111
CERTBOT_WELL_KNOWN_NAME=
106112
CERTBOT_WELL_KNOWN_CONTENTS=
113+
114+
######################
115+
## verification pin ##
116+
######################
117+
VERIFICATION_PIN_TIMEOUT_MS=
118+
VERIFICATION_PIN_EMAIL_INTERVAL_MS=

template/.npmignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

template/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

template/.pug-lintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
disallowStringConcatenation: 'aggressive',
1212
disallowTrailingSpaces: true,
1313
requireLineFeedAtFileEnd: true,
14-
requireLowerCaseAttributes: true,
1514
requireLowerCaseTags: true,
1615
requireSpaceAfterCodeOperator: true,
1716
requireStrictEqualityOperators: true,

template/app/controllers/api/v1/users.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ async function create(ctx) {
1212
return ctx.throw(Boom.badRequest(ctx.translate('INVALID_PASSWORD')));
1313

1414
// register the user
15-
const user = await Users.register({ email: body.email }, body.password);
15+
const query = { email: body.email };
16+
query[config.userFields.hasVerifiedEmail] = false;
17+
query[config.userFields.hasSetPassword] = true;
18+
const user = await Users.register(query, body.password);
19+
20+
// send a verification email
21+
await user.sendVerificationEmail();
1622

1723
// send the response
18-
ctx.body = {
19-
...select(user.toObject(), Users.schema.options.toJSON.select),
20-
api_token: user.api_token
21-
};
24+
const obj = select(user.toObject(), Users.schema.options.toJSON.select);
25+
obj[config.userFields.apiToken] = user[config.userFields.apiToken];
26+
ctx.body = obj;
2227
}
2328

2429
async function retrieve(ctx) {

template/app/controllers/web/admin/users.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,8 @@ async function update(ctx) {
5656
position: 'top'
5757
});
5858

59-
if (ctx.accepts('json')) {
60-
ctx.body = { reloadPage: true };
61-
} else {
62-
ctx.redirect('back');
63-
}
59+
if (ctx.accepts('html')) ctx.redirect('back');
60+
else ctx.body = { reloadPage: true };
6461
}
6562

6663
async function remove(ctx) {
@@ -77,11 +74,8 @@ async function remove(ctx) {
7774
position: 'top'
7875
});
7976

80-
if (ctx.accepts('json')) {
81-
ctx.body = { reloadPage: true };
82-
} else {
83-
ctx.redirect('back');
84-
}
77+
if (ctx.accepts('html')) ctx.redirect('back');
78+
else ctx.body = { reloadPage: true };
8579
}
8680

8781
async function login(ctx) {
@@ -102,11 +96,8 @@ async function login(ctx) {
10296
position: 'top'
10397
});
10498

105-
if (ctx.accepts('json')) {
106-
ctx.body = { redirectTo: '/' };
107-
} else {
108-
ctx.redirect('/');
109-
}
99+
if (ctx.accepts('html')) ctx.redirect('/');
100+
else ctx.body = { redirectTo: '/' };
110101
}
111102

112103
module.exports = { list, retrieve, update, remove, login };

0 commit comments

Comments
 (0)