Skip to content

Commit 59e1cad

Browse files
authored
Merge pull request #142 from neonexus/master
v6.0.0
2 parents 9a558c7 + d4f1893 commit 59e1cad

File tree

14 files changed

+1974
-2599
lines changed

14 files changed

+1974
-2599
lines changed

.ncurc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// This allows us to "lock" Chai into v4.
1+
// This allows us to "lock" packages into specific versions (mostly because of ES updates).
22

33
{
4-
"reject": ["chai", "eslint"]
4+
"reject": ["chai", "eslint", "scrypt-kdf"]
55
}

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# sails-react-bootstrap-webpack
22

3-
[![Travis CI status](https://img.shields.io/travis/com/neonexus/sails-react-bootstrap-webpack.svg?branch=release&logo=travis)](https://app.travis-ci.com/github/neonexus/sails-react-bootstrap-webpack)
4-
[![Sails version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.4%2Fpackage.json&query=%24.dependencies.sails&label=Sails&logo=sailsdotjs)](https://sailsjs.com)
5-
[![React version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.4%2Fpackage.json&query=%24.devDependencies.react&label=React&logo=react)](https://react.dev)
6-
[![Bootstrap version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.4%2Fpackage.json&query=%24.devDependencies.bootstrap&label=Bootstrap&logo=bootstrap&logoColor=white)](https://getbootstrap.com)
7-
[![Webpack version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.4%2Fpackage.json&query=%24.devDependencies.webpack&label=Webpack&logo=webpack)](https://webpack.js.org)
3+
[//]: # ([![Travis CI status](https://img.shields.io/travis/com/neonexus/sails-react-bootstrap-webpack.svg?branch=release&logo=travis)](https://app.travis-ci.com/github/neonexus/sails-react-bootstrap-webpack))
4+
[![Sails version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv6.0.0%2Fpackage.json&query=%24.dependencies.sails&label=Sails&logo=sailsdotjs)](https://sailsjs.com)
5+
[![React version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv6.0.0%2Fpackage.json&query=%24.devDependencies.react&label=React&logo=react)](https://react.dev)
6+
[![Bootstrap version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv6.0.0%2Fpackage.json&query=%24.devDependencies.bootstrap&label=Bootstrap&logo=bootstrap&logoColor=white)](https://getbootstrap.com)
7+
[![Webpack version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv6.0.0%2Fpackage.json&query=%24.devDependencies.webpack&label=Webpack&logo=webpack)](https://webpack.js.org)
8+
9+
Latest version only:
10+
[![FOSSA License Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fneonexus%2Fsails-react-bootstrap-webpack.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fneonexus%2Fsails-react-bootstrap-webpack?ref=badge_shield)
11+
[![FOSSA Security Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fneonexus%2Fsails-react-bootstrap-webpack.svg?type=shield&issueType=security)](https://app.fossa.com/projects/git%2Bgithub.com%2Fneonexus%2Fsails-react-bootstrap-webpack?ref=badge_shield&issueType=security)
812

913
[//]: # ([![Codecov](https://img.shields.io/codecov/c/github/neonexus/sails-react-bootstrap-webpack?logo=codecov)](https://codecov.io/gh/neonexus/sails-react-bootstrap-webpack))
1014

@@ -16,7 +20,7 @@ A virtual start-up in a box!
1620

1721
## Quick Install
1822

19-
NOTE: You will need access to a MySQL / MariaDB database for the setup. If you want to use a different datastore, you'll need to configure it manually.
23+
NOTE: You will need access to a MySQL / MariaDB database for the quick setup. If you want to use a different datastore, you'll need to configure it manually.
2024

2125
[Aiven.io](https://aiven.io) has FREE (no CC required) secure MySQL (5 GB), and Redis (1 GB). Both require use of SSL, and can be restricted to specified IPs. (If you are having trouble finding the
2226
FREE instances, you need to select Digital Ocean as the cloud provider.) Use my [referral link](https://console.aiven.io/signup?referral_code=mk36ekt3wo1dvij7joon) to signup, and you'll get $100
@@ -29,6 +33,9 @@ npm run setup
2933
npm run start OR npm run ngrok
3034
```
3135

36+
NOTE: `drfg` is a secondary, standalone script I've been working on, which can be used for your own projects: [Download Release From GitHub](https://www.npmjs.com/package/drfg). It downloads
37+
/ extracts / installs a release from a GitHub repo. (Currently only supports public repos...) `npx` downloads / runs NPM packages; comes standard with `npm` (at least, as of v5.2.0).
38+
3239
## Table of Contents
3340

3441
* [Main Features](#main-features)

api/helpers/is-password-valid.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ module.exports = {
5151
}
5252

5353
if (inputs.user) {
54-
if (inputs.user.email && inputs.password.indexOf(inputs.user.email) >= 0) {
54+
if (inputs.user.email && inputs.password.toLowerCase().indexOf(inputs.user.email.toLowerCase()) >= 0) {
5555
errors.push('Password can not contain your email address.');
5656
}
5757

58-
if (inputs.user.firstName && inputs.password.indexOf(inputs.user.firstName) >= 0) {
58+
if (inputs.user.firstName && inputs.password.toLowerCase().indexOf(inputs.user.firstName.toLowerCase()) >= 0) {
5959
errors.push('Password can not contain your first name.');
6060
}
6161

62-
if (inputs.user.lastName && inputs.password.indexOf(inputs.user.lastName) >= 0) {
62+
if (inputs.user.lastName && inputs.password.toLowerCase().indexOf(inputs.user.lastName.toLowerCase()) >= 0) {
6363
errors.push('Password can not contain your last name.');
6464
}
6565
}

api/models/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Models
22

3+
Models describe / control the structure of data required for the project.
4+
35
See: https://sailsjs.com/documentation/concepts/models-and-orm/models

api/policies/isLoggedIn.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
const moment = require('moment-timezone');
22

3+
// Standardize messages; not just for ease of change...
4+
const invalid = 'Invalid credentials.';
5+
const notLoggedIn = 'You are not logged in';
6+
37
module.exports = async function(req, res, next) {
48
const sessionId = req.signedCookies[sails.config.session.name] || null; // signed cookies: https://sailsjs.com/documentation/reference/request-req/req-signed-cookies
59

@@ -13,7 +17,7 @@ module.exports = async function(req, res, next) {
1317

1418
await sails.models.session.destroy({id: sessionId});
1519

16-
return res.forbidden('You are not logged in');
20+
return res.forbidden(notLoggedIn);
1721
}
1822

1923
// If the session was found...
@@ -45,15 +49,15 @@ module.exports = async function(req, res, next) {
4549
}
4650

4751
if (!token.includes(':')) {
48-
return res.forbidden('Invalid credentials.');
52+
return res.forbidden(invalid);
4953
}
5054

5155
token = token.split(':');
5256

5357
const foundToken = await sails.models.apitoken.findOne({id: token[0]}).decrypt().populate('user');
5458

5559
if (!foundToken || token[1] !== foundToken.token) {
56-
return res.forbidden('Invalid credentials.');
60+
return res.forbidden(invalid);
5761
}
5862

5963
if (foundToken) {
@@ -66,5 +70,5 @@ module.exports = async function(req, res, next) {
6670
}
6771
}
6872

69-
return res.forbidden('You are not logged in');
73+
return res.forbidden(notLoggedIn);
7074
};

assets/src/index.jsx

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

config/routes.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,26 @@ const fs = require('fs');
1313
const express = require('express'); // Express is a requirement of Sails.
1414

1515
module.exports.routes = {
16-
'GET /': {
17-
skipAssets: true,
18-
fn: (req, res) => {
19-
return res.redirect(302, '/main'); // redirect to the "main" React app (the marketing site)
20-
}
21-
},
16+
// 'GET /': {
17+
// skipAssets: true,
18+
// fn: (req, res) => {
19+
// return res.redirect(302, '/main'); // redirect to the "main" React app (the marketing site)
20+
// }
21+
// },
2222

2323
'GET /*': { // default route used to auto switch React apps
2424
skipAssets: false,
2525
fn: [
2626
express.static(path.resolve(__dirname, '../.tmp/public/')),
2727
async (req, res) => {
2828
// This will determine which React app we need to serve.
29-
const parts = req.url.split('/');
29+
let url = req.url;
30+
31+
if (url === '/') {
32+
url = '/main'; // Default to "main"
33+
}
34+
35+
const parts = url.split('/');
3036
const pathToCheck = path.join(__dirname, '../.tmp/public/', parts[1], '/index.html');
3137

3238
if (fs.existsSync(pathToCheck)) {

0 commit comments

Comments
 (0)