an user > a user

This commit is contained in:
Louis Laureys 2019-07-08 18:14:55 +02:00
parent 231f52d72a
commit 08927831b7
16 changed files with 26127 additions and 41 deletions

View file

@ -86,7 +86,7 @@ node server.js --config=/etc/wildduck.toml
> For additional config options, see the _wild-config_ [documentation](https://github.com/nodemailer/wild-config).
### Step 4\. Create an user account
### Step 4\. Create a user account
See [API Docs](https://api.wildduck.email/#api-Users-PostUser) for details about creating new user accounts

View file

@ -115,7 +115,7 @@ let argv = yargs
)
.command(
'clear <user>',
'Delete all tokens for an user',
'Delete all tokens for a user',
yargs =>
yargs.option('user', {
alias: 'u',

View file

@ -28,7 +28,7 @@ This API is not meant to be used by end users but your application.
* [Reset user password](#reset-user-password)
* [POST /users/{user}/password/reset](#post-usersuserpasswordreset)
* [Authentication](#authentication-1)
* [Authenticate an user](#authenticate-an-user)
* [Authenticate a user](#authenticate-a-user)
* [POST /authenticate](#post-authenticate)
* [List the authentication log](#list-the-authentication-log)
* [GET /users/{user}/authlog](#get-usersuserauthlog)
@ -199,8 +199,8 @@ Returns data about existing users
* **query** is an optional string to filter username (partial match), by default all users are listed
* **limit** is an optional number to limit listing length, defaults to 20
* **tags** is an optional string of comma separated tags. At least a single tag must be set for an user to be listed
* **requiredTags** is an optional string of comma separated tags. All tags must be set for an user to be listed
* **tags** is an optional string of comma separated tags. At least a single tag must be set for a user to be listed
* **requiredTags** is an optional string of comma separated tags. All tags must be set for a user to be listed
**Example**
@ -341,13 +341,13 @@ Response for a successful operation:
}
```
After you have created an user you can use these credentials to log in to the IMAP server.
After you have created a user you can use these credentials to log in to the IMAP server.
### Update user details
#### PUT /users/{user}
Updates the properties of an user. Only specify these fields that you want to be updated.
Updates the properties of a user. Only specify these fields that you want to be updated.
**Parameters**
@ -419,7 +419,7 @@ Response for a successful operation:
#### PUT /users/{user}/logout
Forces closing all active IMAP session of an user
Forces closing all active IMAP session of a user
**Parameters**
@ -472,11 +472,11 @@ Response for a successful operation:
## Authentication
### Authenticate an user
### Authenticate a user
#### POST /authenticate
Authenticates an user
Authenticates a user
**Parameters**
@ -574,7 +574,7 @@ correct scope for email clients using these protocols.
2FA checks do not happen magically, your application must be 2FA aware:
1. Authenticate user with the [/authenticate](#authenticate-an-user) call
1. Authenticate user with the [/authenticate](#authenticate-a-user) call
2. If authentication result includes `requirePasswordChange:true` then force user to change their password
3. If authentication result includes `require2fa:false` then do nothing, the user is now authenticated. Otherwise continue with Step 4. or Step 5.
4. If `require2fa` array includes 'totp' then:
@ -663,7 +663,7 @@ Response for a successful operation:
#### POST /users/{user}/2fa/totp/check
Validates a TOTP token against user 2FA settings. This check should be performed when an user authentication response includes `request2fa:['totp']`
Validates a TOTP token against user 2FA settings. This check should be performed when a user authentication response includes `request2fa:['totp']`
**Parameters**
@ -762,7 +762,7 @@ used to access IMAP, one for SMTP etc.
#### GET /user/{user}/asps
Lists all application specific passwords for an user.
Lists all application specific passwords for a user.
**Parameters**
@ -938,7 +938,7 @@ Response for a successful operation:
#### GET /users/{user}/addresses
Lists all registered email addresses for an user.
Lists all registered email addresses for a user.
**Parameters**
@ -1093,7 +1093,7 @@ Manage user mailboxes
#### GET /user/{user}/mailboxes
Lists existing mailboxes for an user
Lists existing mailboxes for a user
**Parameters**
@ -2019,7 +2019,7 @@ list and restore archived messages. Restoring an archived message resets the UID
#### GET /user/{user}/archived
Lists archived messages for an user. This is similar to listing mailbox messages, major difference being that archived message IDs are not numeric but hex
Lists archived messages for a user. This is similar to listing mailbox messages, major difference being that archived message IDs are not numeric but hex
strings
**Parameters**
@ -2146,7 +2146,7 @@ Response for a successful operation includes the mailbox ID the message was rest
#### POST /users/{user}/quota/reset
Recalculates used storage for an user. Use this when it seems that quota counters for an user do not match with reality.
Recalculates used storage for a user. Use this when it seems that quota counters for a user do not match with reality.
**Parameters**

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -14,7 +14,7 @@ module.exports = (db, server, userHandler) => {
const disableCustom2fa = util.promisify(userHandler.disableCustom2fa.bind(userHandler));
/**
* @api {put} /users/:user/2fa/custom Enable custom 2FA for an user
* @api {put} /users/:user/2fa/custom Enable custom 2FA for a user
* @apiName EnableCustom2FA
* @apiGroup TwoFactorAuth
* @apiDescription This method disables account password for IMAP/POP3/SMTP
@ -102,7 +102,7 @@ module.exports = (db, server, userHandler) => {
);
/**
* @api {delete} /users/:user/2fa/custom Disable custom 2FA for an user
* @api {delete} /users/:user/2fa/custom Disable custom 2FA for a user
* @apiName DisableCustom2FA
* @apiGroup TwoFactorAuth
* @apiDescription This method disables custom 2FA. If it was the only 2FA set up, then account password for IMAP/POP3/SMTP gets enabled again

View file

@ -124,7 +124,7 @@ module.exports = (db, server, userHandler) => {
* @api {post} /users/:user/2fa/totp/enable Enable TOTP seed
* @apiName EnableTotp2FA
* @apiGroup TwoFactorAuth
* @apiDescription This method enables TOTP for an user by verifying the seed value generated from 2fa/totp/setup
* @apiDescription This method enables TOTP for a user by verifying the seed value generated from 2fa/totp/setup
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:
* {
@ -225,7 +225,7 @@ module.exports = (db, server, userHandler) => {
* @api {delete} /users/:user/2fa/totp Disable TOTP auth
* @apiName DisableTotp2FA
* @apiGroup TwoFactorAuth
* @apiDescription This method disables TOTP for an user. Does not affect other 2FA mechanisms an user might have set up
* @apiDescription This method disables TOTP for a user. Does not affect other 2FA mechanisms a user might have set up
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:
* {
@ -311,7 +311,7 @@ module.exports = (db, server, userHandler) => {
* @api {post} /users/:user/2fa/totp/check Validate TOTP Token
* @apiName CheckTotp2FA
* @apiGroup TwoFactorAuth
* @apiDescription This method checks if a TOTP token provided by an User is valid for authentication
* @apiDescription This method checks if a TOTP token provided by a User is valid for authentication
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:
* {
@ -412,7 +412,7 @@ module.exports = (db, server, userHandler) => {
* @api {delete} /users/:user/2fa Disable 2FA
* @apiName Disable2FA
* @apiGroup TwoFactorAuth
* @apiDescription This method disables all 2FA mechanisms an user might have set up
* @apiDescription This method disables all 2FA mechanisms a user might have set up
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:
* {

View file

@ -170,7 +170,7 @@ module.exports = (db, server, userHandler) => {
})
);
// Disable U2F auth for an user
// Disable U2F auth for a user
server.del(
'/users/:user/2fa/u2f',
tools.asyncifyJson(async (req, res, next) => {

View file

@ -38,7 +38,7 @@ module.exports = (db, server, userHandler) => {
* @apiSuccess {String} results.id ID of the Address
* @apiSuccess {String} results.name Identity name
* @apiSuccess {String} results.address E-mail address string
* @apiSuccess {String} results.user User ID this address belongs to if this is an User address
* @apiSuccess {String} results.user User ID this address belongs to if this is a User address
* @apiSuccess {Boolean} results.forwarded If true then it is a forwarded address
*
* @apiError error Description of the error
@ -264,7 +264,7 @@ module.exports = (db, server, userHandler) => {
* @api {post} /users/:user/addresses Create new Address
* @apiName PostUserAddress
* @apiGroup Addresses
* @apiDescription Add a new email address for an User. Addresses can contain unicode characters.
* @apiDescription Add a new email address for a User. Addresses can contain unicode characters.
* Dots in usernames are normalized so no need to create both "firstlast@example.com" and "first.last@example.com"
*
* Special addresses <code>\*@example.com</code>, <code>\*suffix@example.com</code> and <code>username@\*</code> catches all emails to these domains or users without a registered destination (requires <code>allowWildcard</code> argument)
@ -579,7 +579,7 @@ module.exports = (db, server, userHandler) => {
);
/**
* @api {get} /users/:user/addresses List registered Addresses for an User
* @api {get} /users/:user/addresses List registered Addresses for a User
* @apiName GetUserAddresses
* @apiGroup Addresses
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
@ -2310,7 +2310,7 @@ module.exports = (db, server, userHandler) => {
* @apiSuccess {String} id ID of the Address
* @apiSuccess {String} address E-mail address string
* @apiSuccess {String} name Identity name
* @apiSuccess {String} user ID of the user if the address belongs to an User
* @apiSuccess {String} user ID of the user if the address belongs to a User
* @apiSuccess {String[]} targets List of forwarding targets if this is a Forwarded address
* @apiSuccess {Object} limits Account limits and usage for Forwarded address
* @apiSuccess {Object} limits.forwards Forwarding quota

View file

@ -19,7 +19,7 @@ module.exports = (db, server, userHandler) => {
});
/**
* @api {post} /authenticate Authenticate an User
* @api {post} /authenticate Authenticate a User
* @apiName PostAuth
* @apiGroup Authentication
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled

View file

@ -8,7 +8,7 @@ const roles = require('../roles');
module.exports = (db, server) => {
/**
* @api {get} /users/:user/filters List Filters for an User
* @api {get} /users/:user/filters List Filters for a User
* @apiName GetFilters
* @apiGroup Filters
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled

View file

@ -22,7 +22,7 @@ module.exports = (db, server, mailboxHandler) => {
});
/**
* @api {get} /users/:user/mailboxes List Mailboxes for an User
* @api {get} /users/:user/mailboxes List Mailboxes for a User
* @apiName GetMailboxes
* @apiGroup Mailboxes
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled

View file

@ -2714,7 +2714,7 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler) => {
* @apiName ForwardStoredMessage
* @apiGroup Messages
* @apiDescription This method allows either to re-forward a message to an original forward target
* or forward it to some other address. This is useful if an user had forwarding turned on but the
* or forward it to some other address. This is useful if a user had forwarding turned on but the
* message was not delivered so you can try again. Forwarding does not modify the original message.
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:

View file

@ -567,7 +567,7 @@ module.exports = (db, server, messageHandler, userHandler) => {
* @api {post} /users/:user/submit Submit a Message for Delivery
* @apiName PostSubmit
* @apiGroup Submission
* @apiDescription Use this method to send emails from an user account
* @apiDescription Use this method to send emails from a user account
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:
* {

View file

@ -333,7 +333,7 @@ module.exports = (db, server, userHandler) => {
* @apiParam {Boolean} [hashedPassword] If <code>true</code> then password is already hashed, so store as. Hash needs to be bcrypt <code>$2a</code>, <code>$2y</code> or <code>$2b</code>. Additionally md5-crypt hashes <code>$1</code> are allowed but these are rehashed on first successful authentication
* @apiParam {Boolean} [allowUnsafe=true] If <code>false</code> then validates provided passwords against Have I Been Pwned API. Experimental, so validation is disabled by default but will be enabled automatically in some future version of WildDuck.
* @apiParam {String} [address] Default email address for the User (autogenerated if not set)
* @apiParam {Boolean} [emptyAddress] If true then do not autogenerate missing email address for the User. Only needed if you want to create an user account that does not have any email address associated
* @apiParam {Boolean} [emptyAddress] If true then do not autogenerate missing email address for the User. Only needed if you want to create a user account that does not have any email address associated
* @apiParam {Boolean} [requirePasswordChange] If true then requires the user to change password, useful if password for the account was autogenerated
* @apiParam {String[]} [tags] A list of tags associated with this user
* @apiParam {Boolean} [addTagsToAddress] If <code>true</code> then autogenerated address gets the same tags as the user
@ -1619,7 +1619,7 @@ module.exports = (db, server, userHandler) => {
* @api {post} /users/:id/quota/reset Recalculate User quota
* @apiName PostUserQuota
* @apiGroup Users
* @apiDescription This method recalculates quota usage for an User. Normally not needed, only use it if quota numbers are way off.
* @apiDescription This method recalculates quota usage for a User. Normally not needed, only use it if quota numbers are way off.
* This method is not transactional, so if the user is currently receiving new messages then the resulting value is not exact.
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
* @apiHeaderExample {json} Header-Example:
@ -1888,10 +1888,10 @@ module.exports = (db, server, userHandler) => {
);
/**
* @api {post} /users/:id/password/reset Reset password for an User
* @api {post} /users/:id/password/reset Reset password for a User
* @apiName ResetUserPassword
* @apiGroup Users
* @apiDescription This method generates a new temporary password for an User.
* @apiDescription This method generates a new temporary password for a User.
* Additionally it removes all two-factor authentication settings
*
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled
@ -1990,7 +1990,7 @@ module.exports = (db, server, userHandler) => {
);
/**
* @api {delete} /users/:id Delete an User
* @api {delete} /users/:id Delete a User
* @apiName DeleteUser
* @apiGroup Users
* @apiHeader {String} X-Access-Token Optional access token if authentication is enabled

View file

@ -3292,7 +3292,7 @@ class UserHandler {
setImmediate(tryDelete);
}
// returns a query to find an user based on address or username
// returns a query to find a user based on address or username
checkAddress(username, callback) {
if (username.indexOf('@') < 0) {
// not formatted as an address, assume regular username