Skip to content

Commit 7d14a1a

Browse files
committed
Refactored feathers-service-verify-reset as core module
- Removed features which had been deprecated - We made auth generic so it doesn't assume a `user` it just defaults to one but you can customize the `service` and the `entity` options. I think this likely should do the same. 95% of the time it will be a user but this service could easily be applied to other entities (such as an organization). - We can make the `ownId` field more flexible by using `service.id` on [this line](https://github.com/eddyystop/feathers-service-verify-reset/blob/master/src/index.js#L463). See how I do it with [feathers-authentication-jwt](https://github.com/feathersjs/feathers-authentication-jwt/blob/master/src/verifier.js#L21). All datastore backed service adapters now have an `id` field. - Split out the functions inside `index.js` to separate files to make the files smaller and easier to trace through - rename `restrictToVerified` hook to `isVerified` so that it follows the same naming convention as feathers-permissions and feathers-authentication. - rename `userNotifier` to just `notifier` - [these hooks](https://github.com/eddyystop/feathers-service-verify-reset/blob/master/src/index.js#L381-L382) need to change to `auth.hooks.authenticate('jwt')`(or whatever strategy you want) and imho should be registered by the developer instead of hidden away in the service. - FYI if you implement a `setup` method you don't need to do [this](https://github.com/eddyystop/feathers-service-verify-reset/blob/master/src/index.js#L390) here and instead can set `this.service` inside the setup method.
0 parents  commit 7d14a1a

Some content is hidden

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

47 files changed

+5673
-0
lines changed

.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"plugins": [ "add-module-exports" ],
3+
"presets": [ "es2015" ]
4+
}

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.github/contributing.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Contributing to Feathers
2+
3+
Thank you for contributing to Feathers! :heart: :tada:
4+
5+
This repo is the main core and where most issues are reported. Feathers embraces modularity and is broken up across many repos. To make this easier to manage we currently use [Zenhub](https://www.zenhub.com/) for issue triage and visibility. They have a free browser plugin you can install so that you can see what is in flight at any time, but of course you also always see current issues in Github.
6+
7+
## Report a bug
8+
9+
Before creating an issue please make sure you have checked out the docs, specifically the [FAQ](https://docs.feathersjs.com/help/faq.html) section. You might want to also try searching Github. It's pretty likely someone has already asked a similar question.
10+
11+
If you haven't found your answer please feel free to join our [slack channel](http://slack.feathersjs.com), create an issue on Github, or post on [Stackoverflow](http://stackoverflow.com) using the `feathers` or `feathersjs` tag. We try our best to monitor Stackoverflow but you're likely to get more immediate responses in Slack and Github.
12+
13+
Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.
14+
15+
## Report a Security Concern
16+
17+
We take security very seriously at Feathers. We welcome any peer review of our 100% open source code to ensure nobody's Feathers app is ever compromised or hacked. As a web application developer you are responsible for any security breaches. We do our very best to make sure Feathers is as secure as possible by default.
18+
19+
In order to give the community time to respond and upgrade we strongly urge you report all security issues to us. Send one of the core team members a PM in [Slack](http://slack.feathersjs.com) or email us at [email protected] with details and we will respond ASAP.
20+
21+
For full details refer to our [Security docs](https://docs.feathersjs.com/SECURITY.html).
22+
23+
## Pull Requests
24+
25+
We :heart: pull requests and we're continually working to make it as easy as possible for people to contribute, including a [Plugin Generator](https://github.com/feathersjs/generator-feathers-plugin) and a [common test suite](https://github.com/feathersjs/feathers-service-tests) for database adapters.
26+
27+
We prefer small pull requests with minimal code changes. The smaller they are the easier they are to review and merge. A core team member will pick up your PR and review it as soon as they can. They may ask for changes or reject your pull request. This is not a reflection of you as an engineer or a person. Please accept feedback graciously as we will also try to be sensitive when providing it.
28+
29+
Although we generally accept many PRs they can be rejected for many reasons. We will be as transparent as possible but it may simply be that you do not have the same context or information regarding the roadmap that the core team members have. We value the time you take to put together any contributions so we pledge to always be respectful of that time and will try to be as open as possible so that you don't waste it. :smile:
30+
31+
**All PRs (except documentation) should be accompanied with tests and pass the linting rules.**
32+
33+
### Code style
34+
35+
Before running the tests from the `test/` folder `npm test` will run ESlint. You can check your code changes individually by running `npm run lint`.
36+
37+
### ES6 compilation
38+
39+
Feathers uses [Babel](https://babeljs.io/) to leverage the latest developments of the JavaScript language. All code and samples are currently written in ES2015. To transpile the code in this repository run
40+
41+
> npm run compile
42+
43+
__Note:__ `npm test` will run the compilation automatically before the tests.
44+
45+
### Tests
46+
47+
[Mocha](http://mochajs.org/) tests are located in the `test/` folder and can be run using the `npm run mocha` or `npm test` (with ESLint and code coverage) command.
48+
49+
### Documentation
50+
51+
Feathers documentation is contained in Markdown files in the [feathers-docs](https://github.com/feathersjs/feathers-docs) repository. To change the documentation submit a pull request to that repo, referencing any other PR if applicable, and the docs will be updated with the next release.
52+
53+
## External Modules
54+
55+
If you're written something awesome for Feathers, the Feathers ecosystem, or using Feathers please add it to the [showcase](https://docs.feathersjs.com/why/showcase.html). You also might want to check out the [Plugin Generator](https://github.com/feathersjs/generator-feathers-plugin) that can be used to scaffold plugins to be Feathers compliant from the start.
56+
57+
If you think it would be a good core module then please contact one of the Feathers core team members in [Slack](http://slack.feathersjs.com) and we can discuss whether it belongs in core and how to get it there. :beers:
58+
59+
## Contributor Code of Conduct
60+
61+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
62+
63+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
64+
65+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
66+
67+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
68+
69+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
70+
71+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)

.github/issue_template.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### Steps to reproduce
2+
3+
(First please check that this issue is not already solved as [described
4+
here](https://github.com/feathersjs/feathers/blob/master/.github/contributing.md#report-a-bug))
5+
6+
- [ ] Tell us what broke. The more detailed the better.
7+
- [ ] If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.
8+
9+
### Expected behavior
10+
Tell us what should happen
11+
12+
### Actual behavior
13+
Tell us what happens instead
14+
15+
### System configuration
16+
17+
Tell us about the applicable parts of your setup.
18+
19+
**Module versions** (especially the part that's not working):
20+
21+
**NodeJS version**:
22+
23+
**Operating System**:
24+
25+
**Browser Version**:
26+
27+
**React Native Version**:
28+
29+
**Module Loader**:

.github/pull_request_template.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### Summary
2+
3+
(If you have not already please refer to the contributing guideline as [described
4+
here](https://github.com/feathersjs/feathers/blob/master/.github/contributing.md#pull-requests))
5+
6+
- [ ] Tell us about the problem your pull request is solving.
7+
- [ ] Are there any open issues that are related to this?
8+
- [ ] Is this PR dependent on PRs in other repos?
9+
10+
If so, please mention them to keep the conversations linked together.
11+
12+
### Other Information
13+
14+
If there's anything else that's important and relevant to your pull
15+
request, mention that information here. This could include
16+
benchmarks, or other information.
17+
18+
Your PR will be reviewed by a core team member and they will work with you to get your changes merged in a timely manner. If merged your PR will automatically be added to the changelog in the next release.
19+
20+
If your changes involve documentation updates please mention that and link the appropriate PR in [feathers-docs](https://github.com/feathersjs/feathers-docs).
21+
22+
Thanks for contributing to Feathers! :heart:

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.DS_Store
2+
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
13+
# Directory for instrumented libs generated by jscoverage/JSCover
14+
lib-cov
15+
16+
# Coverage directory used by tools like istanbul
17+
coverage
18+
19+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
20+
.grunt
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# Commenting this out is preferred by some people, see
27+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
28+
node_modules
29+
30+
# Users Environment Variables
31+
.lock-wscript
32+
33+
# The compiled/babelified modules
34+
lib/
35+
36+
## editor
37+
.idea/

.istanbul.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
verbose: false
2+
instrumentation:
3+
root: ./src/
4+
excludes:
5+
- lib/
6+
include-all-sources: true
7+
reporting:
8+
print: summary
9+
reports:
10+
- html
11+
- text
12+
- lcov
13+
watermarks:
14+
statements: [50, 80]
15+
lines: [50, 80]
16+
functions: [50, 80]
17+
branches: [50, 80]

.npmignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.editorconfig
2+
.jshintrc
3+
.travis.yml
4+
.istanbul.yml
5+
.babelrc
6+
.idea/
7+
src/
8+
test/
9+
!lib/

.travis.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
node_js:
3+
- 'node'
4+
- '6'
5+
- '4'
6+
addons:
7+
code_climate:
8+
repo_token: 'your repo token'
9+
notifications:
10+
slack: feathersjs:T4tvpJFt27wJZABjLSg5OqMv
11+
email: false
12+
before_script:
13+
- npm install -g codeclimate-test-reporter
14+
after_script:
15+
- codeclimate-test-reporter < coverage/lcov.info

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Notable changes to feathers-authentication-management
2+
3+
## 0.0.0
4+
- Refactored feathers-service-verify-reset.
5+
- Remove deprecated features in feathers-service-verify-reset.

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Feathers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README-plugin.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# feathers-authentication-management
2+
3+
[![Build Status](https://travis-ci.org/feathersjs/feathers-authentication-management.png?branch=master)](https://travis-ci.org/feathersjs/feathers-authentication-management)
4+
[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-authentication-management/badges/gpa.svg)](https://codeclimate.com/github/feathersjs/feathers-authentication-management)
5+
[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-authentication-management/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-authentication-management/coverage)
6+
[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-authentication-management.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-authentication-management)
7+
[![Download Status](https://img.shields.io/npm/dm/feathers-authentication-management.svg?style=flat-square)](https://www.npmjs.com/package/feathers-authentication-management)
8+
9+
> Adds sign up verification, forgotten password reset, and other capabilities to local feathers-authentication
10+
11+
## Installation
12+
13+
```
14+
npm install feathers-authentication-management --save
15+
```
16+
17+
## Documentation
18+
19+
Please refer to the [feathers-authentication-management documentation](http://docs.feathersjs.com/) for more details.
20+
21+
## Complete Example
22+
23+
Here's an example of a Feathers server that uses `feathers-authentication-management`.
24+
25+
```js
26+
const feathers = require('feathers');
27+
const rest = require('feathers-rest');
28+
const hooks = require('feathers-hooks');
29+
const bodyParser = require('body-parser');
30+
const errorHandler = require('feathers-errors/handler');
31+
const plugin = require('feathers-authentication-management');
32+
33+
// Initialize the application
34+
const app = feathers()
35+
.configure(rest())
36+
.configure(hooks())
37+
// Needed for parsing bodies (login)
38+
.use(bodyParser.json())
39+
.use(bodyParser.urlencoded({ extended: true }))
40+
// Initialize your feathers plugin
41+
.use('/plugin', plugin())
42+
.use(errorHandler());
43+
44+
app.listen(3030);
45+
46+
console.log('Feathers app started on 127.0.0.1:3030');
47+
```
48+
49+
## License
50+
51+
Copyright (c) 2016
52+
53+
Licensed under the [MIT license](LICENSE).

0 commit comments

Comments
 (0)