DHUsers provides RESTful API for user management for DuoHuo Apps, using Node.js & MongoDB.
- APIKey - All requests should contain apikey parameter, such as POST http://example.com/u/test?apikey=yourpaikeyhere
- IP whitelist (optional) only IPs in a array could invoke the API server. This can be edited in config.
Path: /reg
Method: POST
body:
usernamemust be alphanumericemailmust be valid emailpasswordbetter to be encrypted. Will be encrypted again using sha256.siteurlthe url the user shall be redirected to(such as http://app.example.com/login). Will displayed in email sent to user for activation or other stuff.
Path: /login
Method: POST
body:
usernamefor login userpasswordfor login credentialsipaddressfor security logs
Path: /forgot-password
Method: POST
body:
email: email address that resetkey will be sent to.siteurl: url the user will be redirected to.ipaddress: for security logs & emails.
Path: /u/[username]
Method: GET
Params:
usernameusername's information to get. E.g., GET http://example.com/u/testuser
Path: /u/[username]
Method: POST
body:
emailuser's email (can be updated)passworduser's password. ATTENTION DHUsers will NOT check the password, please ensure the current user has correct privilege to change the password, or just keep it unchanged. This variable can be old password or new password.
All return results will be in JSON format.
status:OK|ERRORmessage: Additional message for result.user: User information in JSON format.
Example:
GET /u/test
And get:
{
"status": "OK",
"message": "",
"user": {
"name": "test",
"password": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"email": "test@test.com",
"role": "user"
}
}- Pages for account activation.
- Pages for password reset.