Skip to content

Commit cee8914

Browse files
committed
- Security: Minimize XSS vectors by using safer jQuery methods
- Enhancement: Database abstraction layer - Enhancement: Autocomplete hints - Enhancement: `localScripts` option for using non-CDN copies - Enhancement: Use native form validation - Enhancement: Make `fromText` and `fromURL` of password reset emails configurable - Enhancement: Upon signup, ask for password confirmation - Enhancement: Require email link verification code (inspired by <braitsch#11>) - Fix: Requiring of `account.js` - Fix: Pass on CLI args properly - Fix: Add proper plain text for plain text email - i18n: Client-side i18n - Docs: Add Change log for unreleased - Docs: Indicate planned to-dos - Docs: Some further CLI documentation - Refactoring: Further separation of view logic out of controllers - Refactoring: Switch to Jamilih templates - Refactoring: Add scripts to head with `defer` - Refactoring: Use variables in place of selectors where possible - Linting (ESLint): As per latest ash-nazg - npm: Update mongodb, jamilih, jsdom, and devDeps
1 parent eba1030 commit cee8914

File tree

98 files changed

+7253
-4942
lines changed

Some content is hidden

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

98 files changed

+7253
-4942
lines changed

.editorconfig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,3 @@ insert_final_newline = true
1010
indent_style = space
1111
indent_size = 2
1212
trim_trailing_whitespace = true
13-
14-
[app/public/css/**.styl]
15-
indent_style = tab
16-
indent_size = 2
17-
18-
[app/server/views/**.pug]
19-
indent_style = tab
20-
indent_size = 1

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
instrumented/**
33
coverage/**
4+
!.ncurc.js

.eslintrc.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ module.exports = {
44
"plugin:node/recommended-script",
55
"plugin:cypress/recommended"
66
],
7-
"plugins": [
8-
"pug"
9-
],
107
"env": {
118
"es6": true
129
},
@@ -46,11 +43,6 @@ module.exports = {
4643
"ecmaVersion": 2018,
4744
"sourceType": "module"
4845
}
49-
}, {
50-
files: ["*.pug"],
51-
rules: {
52-
'eol-last': 0
53-
}
5446
}],
5547
"rules": {
5648
"import/no-commonjs": 0,

.ncurc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
module.exports = {
4+
// Whitelist all for checking besides `peer` which indicates
5+
// somewhat older versions of `eslint` we still support even
6+
// while our devDeps point to a more recent version
7+
dep: 'prod,dev,optional,bundle',
8+
reject: [
9+
// Todo[bootstrap@>4.4.1]: See if updated for css, js, and popper.js at https://github.com/twbs/bootstrap/blob/master/config.yml
10+
'bootstrap',
11+
'popper.js'
12+
]
13+
};

.pug-lintrc.js

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

CHANGES.md

Lines changed: 123 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,130 @@
1-
**v1.7.2** –– 11-18-2018
1+
# CHANGES for node-login
2+
3+
## ?
4+
5+
- Breaking enhancement: Avoid `process.env` (`app.js` accepts CLI now instead)
6+
- Breaking enhancement: Allow app to pass in own countries list
7+
- Breaking refactoring: `EmailDispatcher` and `AccountManager` are now classes;
8+
routes accepts config
9+
- Security: Add PBKDF2 hashing (@SCG82)
10+
- Security: Make "secret" private and configurable; add
11+
integrity/cross-origin=anonymous for jquery.form and font-awesome
12+
(switching to same CDN); add also for github-fork-ribbon-css, but comment
13+
out as not in apparent use
14+
- Security: Use signed cookie
15+
- Security: Pass secret to cookie parser as otherwise potentially problematic
16+
- Security: Rate-limiting (for DoS)
17+
- Security: Minimize XSS vectors by using safer jQuery methods
18+
- Fix: Accessibility (except for `color-contrast` whose check we are
19+
temporarily disabling until may have time to fix)
20+
- Fix: Add proper plain text for plain text email
21+
- Update: Use now required Mongodb APIs
22+
- Update: CDN for bootstrap (CSS and JS), jquery, popper
23+
- Enhancement: Database abstraction layer
24+
- Enhancement: Autocomplete hints
25+
- Enhancement: More configurabiity
26+
- Enhancement: i18n (server-side, client-side, and CLI)
27+
- Enhancement: Make available as binary (with help/version and
28+
update-notifier)
29+
- Enhancement: Add `use strict`
30+
- Enhancement: `localScripts` option for using non-CDN copies
31+
- Enhancement: Use native form validation
32+
- Enhancement: Make `fromText` and `fromURL` of password reset emails
33+
configurable
34+
- Enhancement: Require email link verification code (inspired by
35+
<https://github.com/braitsch/node-login/pull/11>)
36+
- Fix: Requiring of `account.js`
37+
- Fix: Pass on CLI args properly
38+
- Docs: Add Change log for unreleased
39+
- Docs: Indicate planned to-dos
40+
- Docs: Some further CLI documentation
41+
- Docs: CLI
42+
- Linting (ESLint): Apply eslint-config-ash-nazg
43+
- Refactoring: Destructuring; arrow functions for handlers;
44+
utilize succincter stylus features
45+
- Refactoring: convert further APIs to (async/await) Promises
46+
- Refactoring: Avoid inline styles
47+
- Refactoring: Further separation of view logic out of controllers
48+
- Refactoring: Switch to Jamilih templates
49+
- Refactoring: Add scripts to head with `defer`
50+
- Refactoring: Use variables in place of selectors where possible
51+
- Linting (ESLint): As per latest ash-nazg
52+
- Testing: Cypress testing, including axe accessibility testing;
53+
add sourcemaps to stylus; coverage
54+
- Maintenance: Add `.editorconfig`
55+
- npm: Mongodb and server start scripts
56+
- npm: Add recommended `package.json` fields; allow Node >= 10.4.0 in `engines`
57+
- npm: Update deps and devDeps
58+
59+
## v1.7.2 –– 11-18-2018
60+
61+
- auto-login & password-reset now validating against UUIDs and the user's last recorded IP address
62+
63+
## v1.7.1 –– 11-18-2018
64+
65+
- updating mongodb calls to latest driver
66+
- [fix for #12](https://github.com/braitsch/node-login/pull/12)
67+
68+
## v1.7.0 –– 11-18-2018
69+
70+
- updated dependencies to latest versions
71+
- bootstrap v4.1.3 & jquery v3.3.1
72+
- style.css completely rewritten
73+
- [fix for #36](https://github.com/braitsch/node-login/issues/36)
74+
75+
## v1.6.0 –– 06-10-2018
76+
77+
- updated dependencies to latest versions
78+
- updated mongodb connection scheme
79+
- replaced jade templating engine with pug
80+
81+
## v1.5.0 –– 04-21-2016
82+
83+
- redesigned login window
84+
- improved error handling on password reset
85+
- updating client side libraries:
86+
- jQuery –– v2.2.3
87+
- jQuery.form –– v3.51.0
88+
- Twitter Bootstrap –– v3.3.6
89+
90+
## v1.4.1 –– 02-27-2016
91+
92+
- calls to logout now route to /logout instead of /home
93+
- accounts are now looked up by session.id instead of username
94+
- reset-password modal window fixes
95+
- updating emailjs to v1.0.4
96+
- switching to environment variables for email settings
97+
98+
## v1.4.0 –– 06-14-2015
99+
100+
- updating to Express v4.12.4
101+
- adding connect-mongo for db session store
102+
103+
## v1.3.2 –– 03-11-2013
104+
105+
- fixed bug on password reset
106+
107+
## v1.3.1 –– 03-07-2013
108+
109+
- adding MIT license
110+
111+
## v1.3.0 –– 01-10-2013
112+
113+
- updating to Express v3.0.6
114+
115+
## v1.2.1 –– 01-03-2013
2116

3-
* auto-login & password-reset now validating against UUIDs and the user's last recorded IP address
117+
- moving vendor libs to /public/vendor
4118

5-
**v1.7.1** –– 11-18-2018
119+
## v1.2.0 –– 12-27-2012
6120

7-
* updating mongodb calls to latest driver
8-
* [fix for #12](https://github.com/braitsch/node-login/pull/12)
121+
- updating MongoDB driver to 1.2.7
122+
- replacing bcrypt module with native crypto
9123

10-
**v1.7.0** –– 11-18-2018
124+
## v1.1.0 –– 08-12-2012
11125

12-
* updated dependencies to latest versions
13-
* bootstrap v4.1.3 & jquery v3.3.1
14-
* style.css completely rewritten
15-
* [fix for #36](https://github.com/braitsch/node-login/issues/36)
126+
- adding /print & /reset methods
16127

17-
**v1.6.0** –– 06-10-2018
128+
## v1.0.0 –– 08-07-2012
18129

19-
* updated dependencies to latest versions
20-
* updated mongodb connection scheme
21-
* replaced jade templating engine with pug
22-
23-
**v1.5.0** –– 04-21-2016
24-
25-
* redesigned login window
26-
* improved error handling on password reset
27-
* updating client side libraries:
28-
* jQuery –– v2.2.3
29-
* jQuery.form –– v3.51.0
30-
* Twitter Bootstrap –– v3.3.6
31-
32-
**v1.4.1** –– 02-27-2016
33-
34-
* calls to logout now route to /logout instead of /home
35-
* accounts are now looked up by session.id instead of username
36-
* reset-password modal window fixes
37-
* updating emailjs to v1.0.4
38-
* switching to environment variables for email settings
39-
40-
--
41-
**v1.4.0** –– 06-14-2015
42-
43-
* updating to Express v4.12.4
44-
* adding connect-mongo for db session store
45-
46-
--
47-
**v1.3.2** –– 03-11-2013
48-
49-
* fixed bug on password reset
50-
51-
--
52-
**v1.3.1** –– 03-07-2013
53-
54-
* adding MIT license
55-
56-
--
57-
**v1.3.0** –– 01-10-2013
58-
59-
* updating to Express v3.0.6
60-
61-
--
62-
**v1.2.1** –– 01-03-2013
63-
64-
* moving vendor libs to /public/vendor
65-
66-
--
67-
**v1.2.0** –– 12-27-2012
68-
69-
* updating MongoDB driver to 1.2.7
70-
* replacing bcrypt module with native crypto
71-
72-
--
73-
**v1.1.0** –– 08-12-2012
74-
75-
* adding /print & /reset methods
76-
77-
--
78-
**v1.0.0** –– 08-07-2012
79-
80-
* initial release
81-
82-
--
130+
- initial release

README.md

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
### A basic account management system built in Node.js with the following features:
66

7-
* New User Account Creation
8-
* Secure Password Reset via Email
9-
* Ability to Update / Delete Account
10-
* Session Tracking for Logged-In Users
11-
* Local Cookie Storage for Returning Users
12-
* Blowfish-based Scheme Password Encryption
7+
- New User Account Creation
8+
- Secure Password Reset via Email
9+
- Ability to Update / Delete Account
10+
- Session Tracking for Logged-In Users
11+
- Local Cookie Storage for Returning Users
12+
- Blowfish-based Scheme Password Encryption
1313

1414
## Live Demo
1515

@@ -23,17 +23,23 @@ For testing purposes you can view a [database dump of all accounts here](https:/
2323

2424
2. Clone this repository and install its dependencies.
2525

26-
> git clone git://github.com/braitsch/node-login.git node-login
27-
> cd node-login
28-
> npm install
26+
```sh
27+
git clone git://github.com/braitsch/node-login.git node-login
28+
cd node-login
29+
npm install
30+
```
2931

3032
3. In a separate shell start MongoDB.
3133

32-
> mongod
34+
```sh
35+
mongod
36+
```
3337

3438
4. From within the node-login directory start the server.
3539

36-
> node app
40+
```sh
41+
node app
42+
```
3743

3844
5. Open a browser window and navigate to: [http://localhost:3000](http://localhost:3000)
3945

@@ -43,9 +49,11 @@ To enable the password retrieval feature it is recommended that you create envir
4349

4450
To do this on OSX you can simply add them to your `.profile` or `.bashrc` file.
4551

46-
export NL_EMAIL_HOST='smtp.gmail.com'
47-
export NL_EMAIL_USER='your.email@gmail.com'
48-
export NL_EMAIL_PASS='1234'
52+
```sh
53+
export NL_EMAIL_HOST='smtp.gmail.com'
54+
export NL_EMAIL_USER='your.email@gmail.com'
55+
export NL_EMAIL_PASS='1234'
56+
```
4957

5058
[![node-login](./readme_includes/retrieve-password.jpg?raw=true)](https://nodejs-login.herokuapp.com)
5159

@@ -74,3 +82,44 @@ On the Mac, you can follow these steps to resolve:
7482
## Contributing
7583

7684
Questions and suggestions for improvement are welcome.
85+
86+
## To-dos
87+
88+
1. **Testing** coverage:
89+
1. Try to get testing coverage between client and server integrated,
90+
so can see any total missing coverage
91+
1. Specific issues
92+
1. Figure out why `print` page still shows an account upon (first)
93+
deletion
94+
1. Get validation to reset on change or input events
95+
1. Get to 100% coverage
96+
1. Update **docs** above
97+
98+
1. Role-based **privileges** (esp. for reset/delete!) with **admin screens**
99+
1. Groups allowing multiple roles, including user-customizable ones in
100+
addition to built-in ones such as login
101+
1. See to-dos in code for methods needing these!
102+
1. Update docs for any privilege additions/config
103+
104+
1. **Theme switching**?
105+
1. Publish **release**
106+
107+
## Medium priorities
108+
109+
1. **Captchas** ([svg-captcha](https://www.npmjs.com/package/svg-captcha)
110+
(doesn't use easily breakable SVG text, and could convert to image))
111+
1. **Security** CSRF protection
112+
1. Provide **option for integration** within an existing page to avoid need
113+
for separate login page
114+
1. See about **`passport-next`** integration
115+
1. **BrowserID** - Implement browser add-on (or work with existing Persona)
116+
to use with a server-side validation
117+
1. Link to **resend verification**
118+
119+
## Lower priorities
120+
121+
1. Switch from `jsdom` to **`dominum`** (once latter may be capable) and add
122+
tests within `jamilih` for the integration
123+
1. See about minor **to-dos in code** along the way
124+
1. Review **client-side validation** for any other opportunities (e.g., for
125+
any missing `required` fields, etc.)

0 commit comments

Comments
 (0)