Skip to content

Commit

Permalink
docs: fix heading levels (#186)
Browse files Browse the repository at this point in the history
* docs: update heading levels

* docs: update dependency

* docs: add head meta
  • Loading branch information
fratzinger committed Sep 22, 2022
1 parent 9305cb7 commit f7e6ec3
Show file tree
Hide file tree
Showing 16 changed files with 3,258 additions and 3,742 deletions.
48 changes: 38 additions & 10 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
import { defineConfig } from 'vitepress'
import { version } from '../../package.json'
import { description, name, ogImage, ogUrl } from './meta';

export default defineConfig({
title: "feathers-auth-mgmt",
description:
"Sign up verification, forgotten password reset, and other capabilities for local authentication",
head: [['link', { rel: 'icon', href: '/favicon.ico' }]],
head: [
['link', { rel: 'icon', href: '/favicon.ico' }],
["meta", { name: "theme-color", content: "#64007a" }],
["meta", { property: "og:title", content: name }],
["meta", { property: "og:description", content: description }],
["meta", { property: "og:url", content: ogUrl }],
["meta", { property: "og:image", content: ogImage }],
["meta", { name: "twitter:title", content: name }],
["meta", { name: "twitter:description", content: description }],
["meta", { name: "twitter:image", content: ogImage }],
["meta", { name: "twitter:card", content: "summary_large_image" }],
],
themeConfig: {
logo: '/logo.svg',
editLink: {
pattern: 'https://github.com/feathersjs-ecosystem/feathers-authentication-management/edit/main/docs/:path',
text: 'Edit this page on GitHub'
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/feathersjs-ecosystem/feathers-authentication-management' },
{ icon: 'discord', link: 'https://discord.gg/C6rSjSWR' }
{
icon: "twitter",
link: "https://twitter.com/feathersjs",
},
{
icon: "discord",
link: "https://discord.gg/qa8kez8QBx",
},
{
icon: "github",
link: "https://github.com/feathersjs-ecosystem/feathers-authentication-management",
},
],
footer: {
message: 'Released under the MIT License.',
Expand Down Expand Up @@ -53,13 +76,18 @@ export default defineConfig({
],
nav: [
{
text: 'Config',
link: '/configuration'
},
{
text: 'Changelog',
link: 'https://github.com/feathersjs-ecosystem/feathers-authentication-management/blob/master/CHANGELOG.md'
text: `v${version}`,
items: [
{
text: 'Changelog',
link: 'https://github.com/feathersjs-ecosystem/feathers-authentication-management/blob/master/CHANGELOG.md'
},
{
text: 'Contributing',
link: 'https://github.com/feathersjs-ecosystem/feathers-authentication-management/blob/master/.github/contributing.md'
}
]
}
]
],
}
});
5 changes: 5 additions & 0 deletions docs/.vitepress/meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const name = "feathers-authentication-management";
export const description = "Adds sign up verification, forgotten password reset, and other capabilities to local feathers-authentication";

export const ogUrl = "https://feathers-a-m.netlify.app/";
export const ogImage = "https://feathers-a-m.netlify.app/logo.png";
1 change: 0 additions & 1 deletion docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!--.vitepress/theme/Layout.vue-->
<script setup lang="ts">
import DefaultTheme from "vitepress/theme"
import "./store"
Expand Down
13 changes: 13 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,16 @@
--vp-c-brand-dark: #d000ff;
--vp-c-brand-darker: #d000ff;
}

/**
* Component: Home
* -------------------------------------------------------------------------- */

:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
120deg,
#64007a 20%,
#8e00ad
);
}
2 changes: 1 addition & 1 deletion docs/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Best Practices
---

# {{ $frontmatter.title }}
# Best Practices

## Security

Expand Down
6 changes: 1 addition & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
title: Configuration
---

# {{ $frontmatter.title }}
# Configuration

The `feathers-authentication-management` service is configured at several positions of a Feathers application:

Expand Down
6 changes: 1 addition & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
title: Getting Started
---

# {{ $frontmatter.title }}
# Getting Started

## Introduction

Expand Down
3 changes: 1 addition & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
sidebar: false
layout: home
hero:
name: f-a-m
text: feathers-authentication-management
name: feathers-authentication-management
tagline: Sign up verification, forgotten password reset, and other capabilities for local authentication.
image:
src: /logo.svg
Expand Down
26 changes: 11 additions & 15 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
---
title: Migrating
---

# {{ $frontmatter.title }}
# Migrating

This guide explains the new features and changes necessary to migrate to `feathers-authentication-management` (called `f-a-m` from now on) v4. The migration should be fairly easy. There's no breaking change at all. So just install the pre-release. That should be it. Just continue reading if you're curious what has changed.

```bash
npm i feathers-authentication-management
```

### ❗️❗️❗️ Don't expose `f-a-m` data to socket.io by default
## ❗️❗️❗️ Don't expose `f-a-m` data to socket.io by default

Do you use `socket.io` and [channels](https://docs.feathersjs.com/api/channels.html) with `feathers-authentication-management`? Did you know, that the service `authManagment` publishes every `create` request to channels? We created a [test](https://github.com/feathersjs-ecosystem/feathers-authentication-management/blob/illustrate-publish-leak/test/scaffolding.test.js#L108) to illustrate the behavior. See the [test results](https://github.com/feathersjs-ecosystem/feathers-authentication-management/runs/4764626400?check_suite_focus=true).
If you do not catch that, every client received your `data` from `authManagement`. This is fixed in `f-a-m` v4 and follows the same as the official `@feathersjs/authentication`. If you don't filter the data from `authManagement`, you should upgrade asap or handle data from `authManagement` in your `channels`-file!

This could be a breaking change, if you use the published data of `authManagement` intentionally which is considered bad practice. You should use hooks instead!

### Typescript
## Typescript

`feathers-authentication-management` v4 is rewritten in typescript. That means autocompletition in your IDE.

### Separate services and custom methods
## Separate services and custom methods

Before `f-a-m` v4 there was only a main service, with a lot of `actions` for the `create` method. `f-a-m` v4 also has that but also exposes two new options to configure your feathers app. So we have three ways:
1. `old fashioned`: one main service
Expand All @@ -47,7 +43,7 @@ To illustrate the new services and custom methods and its corresponding old fash

But the `data` for the new **separate services** and **custom methods** is also flattened compared to the old fashioned main service. See the following example for the action: `'sendResetPwd'`:

#### Old Fashioned
### Old Fashioned

```js
const { AuthenticationManagementService } = require('feathers-authentication-management');
Expand All @@ -61,7 +57,7 @@ app.service("auth-management").create({
});
```

#### Separate Service
### Separate Service

```js
const { SendResetPwdService } = require('feathers-authentication-management');
Expand All @@ -74,7 +70,7 @@ app.service("auth-management/send-reset-password").create({
});
```

#### Custom Method
### Custom Method

```js
const { AuthenticationManagementService } = require('feathers-authentication-management');
Expand All @@ -89,11 +85,11 @@ app.service("auth-management").sendResetPassword({

This is also documented in the chapter [Service Calls](./service-calls). Check that chapter out, if you need more information.

### Multi support for hook `addVerification`
## Multi support for hook `addVerification`

The hook `addVerification` was not able to handle `multi` data. It is now.

### Recommended setup
## Recommended setup

The old docs of `f-a-m` v3 said, that you need to use `app.configure(authManagement())`. We don't know why, but it is not necessary. You can use:
```js
Expand All @@ -114,12 +110,12 @@ module.exports = function (app) {
};
```

### Recommended Service Path
## Recommended Service Path

The default path of `app.configure(authManagement())` is `app.service('authManagement')`. Note the `camelCasing`. We consider this an anti-pattern and recommend using `kebab-casing`. That's why the [Getting Started](./getting-started) guide uses `kebab-casing`.

The hook `addVerification` optionally takes the service path as first argument. Because we don't want to break things, the default path stays `'authManagement'` as in `f-a-m` v3. So, if you change to `kebab-case`, please make sure, to call `addVerification('auth-management')`.

### Option `passwordField`
## Option `passwordField`

`f-a-m` v3 did not use a `passwordField` option. It defaults to `password`. This new option follows the options for `@feathersjs/authentication`.
12 changes: 4 additions & 8 deletions docs/overview.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
title: Overview
---

# {{ $frontmatter.title }}
# Overview

<p align="center">
<img src="/logo.svg" width="250">
Expand All @@ -21,7 +17,7 @@ This project is built for [Feathers](http://feathersjs.com) – an open source f

The Feathers core provides a [LocalStrategy](https://docs.feathersjs.com/api/authentication/local.html) for authenticating users with a username/e-mail and password combination. However, it does not include methods such as the verification of a user's e-mail address or sending a password reset link. The purpose of `feathers-authentication-management` is to extend Feathers's local authentication with such functionalities.

### Features
## Features

- User verification by sending a token-based verification URL.
- Password reset notifications, e. g. for forgotten password functions.
Expand All @@ -36,7 +32,7 @@ For most of the actions, `feathers-authentication-management` sends notification

Details about settings and the implementation of a notifier function can be found in chapter [Configuration](./configuration). All possible actions of this service are described in chapter [Service Calls](./service-calls).

### Help
## Help

- Open an issue or come talk on the Feathers Slack ([slack.feathersjs.com](http://slack.feathersjs.com/)).

Expand All @@ -46,6 +42,6 @@ Details about settings and the implementation of a notifier function can be foun

- [The how and why of 2FA using Twilio and Feathers.js — Simple 2FA tutorial](https://harryhopalot.medium.com/the-how-and-why-of-2fa-using-twilio-and-feathers-js-simple-2fa-tutorial-e64a930a57a8) – Medium article by Harry Blakiston Houston (06/2018),

### License
## License

Licensed under the [MIT license](https://github.com/feathersjs-ecosystem/feathers-authentication-management/blob/master/LICENSE).
6 changes: 1 addition & 5 deletions docs/process-flows.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
title: Process Flows
---

# {{ $frontmatter.title }}
# Process Flows

Some of the process flows related to this service are described in this chapter in more detail. They are meant as examples how the service works and what additional implementations are required.

Expand Down
32 changes: 12 additions & 20 deletions docs/service-calls.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
title: Service Calls
---

# {{ $frontmatter.title }}
# Service Calls

The `feathers-authentication-management` service methods can be called using various ways. These can be external calls from the client as well as internal calls within the server. On client side, you can use the [Feathers client](https://docs.feathersjs.com/api/client.html), plain and simple HTTP requests, or any other request library your frontend framework provides.

Expand Down Expand Up @@ -69,11 +65,7 @@ app.service("auth-management").sendResetPassword({

</Tabs>

## List of Service Calls

All service calls return a promise.

### checkUnique
## checkUnique

Checks if the properties are unique in the users items.

Expand Down Expand Up @@ -129,7 +121,7 @@ app.service('auth-management').checkUnique({
Returns `null` if the properties are unique (= already existing) in the users items. Otherwise rejects with `BadRequest`.
### identityChange
## identityChange
Changes the communication address of a user, e. g. the e-mail address or a phone number.
Expand Down Expand Up @@ -190,7 +182,7 @@ app.service('auth-management').identityChange({
Returns the user object or rejects with `BadRequest`.
### passwordChange
## passwordChange
Changes the password of a user.
Expand Down Expand Up @@ -251,7 +243,7 @@ app.service('auth-management').passwordChange({
Returns the user object or rejects with `BadRequest`.
### resendVerifySignup
## resendVerifySignup
Recreates a long and/or short verification token, stores it to the user item, and triggers the notifier function to send the token to the user.
Expand Down Expand Up @@ -304,7 +296,7 @@ app.service('auth-management').resendVerifySignup({
Returns the user object or rejects with `BadRequest`.
### resetPwdLong
## resetPwdLong
Stores a new password. Requires a valid long `resetToken`.
Expand Down Expand Up @@ -365,7 +357,7 @@ app.service('auth-management').resetPasswordLong({
Returns the user object or rejects with `BadRequest`.
### resetPwdShort
## resetPwdShort
Stores a new password. Requires a valid short `resetShortToken` and a property of the user object to identify the user.
Expand Down Expand Up @@ -426,7 +418,7 @@ app.service('auth-management').resetPasswordShort({
Returns the user object or rejects with `BadRequest`.
### sendResetPwd
## sendResetPwd
Creates a short and/or long password reset token, stores it to the user item, and triggers the notifier function to send the token to the user.
Expand Down Expand Up @@ -479,7 +471,7 @@ app.service('auth-management').sendResetPassword({
Returns the user object or rejects with `BadRequest`.
### verifySignupLong
## verifySignupLong
Verifies a given long verification token.
Expand Down Expand Up @@ -532,7 +524,7 @@ app.service('auth-management').verifySignupLong({
Returns the user object or rejects with `BadRequest`.
### verifySignupShort
## verifySignupShort
Verifies a given short verification token.
Expand Down Expand Up @@ -591,7 +583,7 @@ app.service('auth-management').verifySignupShort({
Returns the user object or rejects with `BadRequest`.
### verifySignupSetPasswordLong
## verifySignupSetPasswordLong
This is a combination of `verifySignupLong` and `resetPwdLong`: Verifies a given long verification token and stores the new password.
Expand Down Expand Up @@ -649,7 +641,7 @@ app.service('auth-management').verifySignupSetPasswordLong({
Returns the user object or rejects with `BadRequest`.
### verifySignupSetPasswordShort
## verifySignupSetPasswordShort
This is a combination of `verifySignupShort` and `resetPwdShort`: Verifies a given short verification token and stores the new password.
Expand Down
Loading

0 comments on commit f7e6ec3

Please sign in to comment.