Skip to content

staff.password ​

2 methods on staff.password. Each returns the answer's data and throws NoviqaError on a failed answer.

forgot ​

POST/admin/v1/password/forgot

E-mail a password recovery code (staff)

Public. Send the login and its e-mail; when they match an account of this side a code is e-mailed. The answer is the same either way.

Request body
codestring
emailstring
logininteger
Login is the numeric identity of every account, trader or staff.
passwordstring
Returns
Promise<docSent>
The answer's data.
Errors
400invalid_input: invalid input
403forbidden: you do not have access to this action
429auth.too_many_attempts: too many attempts, try again later
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.password.forgot({
  email: "ann@example.com",
  login: 1000
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/password/forgot" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "email": "ann@example.com",
  "login": 1000
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "sent": true
  },
  "request_id": "5b7f2c1e"
}
ts
staff.password.forgot(body: auth.Recovery, options?: RequestOptions): Promise<http.docSent>

reset ​

POST/admin/v1/password/reset

Set a new password with the e-mailed code (staff)

Public. Login, e-mail, the code and the new password. Closes every session of the login.

Request body
codestring
emailstring
logininteger
Login is the numeric identity of every account, trader or staff.
passwordstring
Returns
Promise<null>
The answer's data.
Errors
400auth.code_invalid: the verification code is wrong or has expired
400auth.password_weak: password must be 8-16 characters with a lower, upper, digit and symbol
400invalid_input: invalid input
403forbidden: you do not have access to this action
429auth.too_many_attempts: too many attempts, try again later
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.password.reset({
  code: "123456",
  email: "ann@example.com",
  login: 1000,
  password: "N3w#Pass1"
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/password/reset" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "code": "123456",
  "email": "ann@example.com",
  "login": 1000,
  "password": "N3w#Pass1"
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": null,
  "request_id": "5b7f2c1e"
}
ts
staff.password.reset(body: auth.Recovery, options?: RequestOptions): Promise<null>