updated api preview examples

This commit is contained in:
Gani Georgiev
2026-05-14 10:02:42 +03:00
parent fbf4f3e5fb
commit 9d50e20880
9 changed files with 42 additions and 16 deletions

View File

@@ -11,6 +11,8 @@
- Updated `modernc.org/sqlite` to v1.50.1 (SQLite 3.53.1).
- Other minor fixes (_updated API preview examples, fixed code comment typos, etc._).
## v0.38.0

View File

@@ -1,4 +1,4 @@
import{t as e}from"./expandInfo-DGS0CLSa.js";import{t as n}from"./fieldsInfo-Bz62125-.js";function r(e){let n=app.utils.getApiExampleURL(),r=[{title:`OTP request`,content:i},{title:`OTP auth`,content:a}],o=store({activeActionIndex:0});return t.div({pbEvent:`apiPreviewAuthWithOTP`,className:`content`},t.p(null,`Authenticate with an one-time/short-lived password (OTP).`),t.p(null,`Note that when requesting an OTP we return an `,t.code(null,`otpId`),` even if a user with the provided email doesn't exist as a very basic enumeration protection.`),app.components.codeBlockTabs({className:`sdk-examples m-t-sm`,historyKey:`pbLastSDK`,tabs:[{title:`JS SDK`,language:`js`,value:`
import{t as e}from"./expandInfo-DGS0CLSa.js";import{t as n}from"./fieldsInfo-Bz62125-.js";function r(e){let n=app.utils.getApiExampleURL(),r=[{title:`OTP request`,content:i},{title:`OTP auth`,content:a}],o=store({activeActionIndex:0});return t.div({pbEvent:`apiPreviewAuthWithOTP`,className:`content`},t.p(null,`Authenticate with an one-time/short-lived password (OTP).`),t.p(null,`On successful authentication the user will be also marked as verified (if the OTP source is email and the user is not verified already).`),t.p(null,`Note that when requesting an OTP we return an `,t.code(null,`otpId`),` even if a user with the provided email doesn't exist as a very basic enumeration protection.`),app.components.codeBlockTabs({className:`sdk-examples m-t-sm`,historyKey:`pbLastSDK`,tabs:[{title:`JS SDK`,language:`js`,value:`
import PocketBase from 'pocketbase';
const pb = new PocketBase('${n}');

View File

@@ -1,4 +1,4 @@
function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request email change`,content:n},{title:`Confirm email change`,content:r}],o=store({activeActionIndex:0});return t.div({pbEvent:`apiPreviewEmailChange`,className:`content`},t.p(null,`Sends ${e.name} email change request.`),t.p(null,`On successful email change all previously issued auth tokens for the specific record will be automatically invalidated.`),app.components.codeBlockTabs({className:`sdk-examples m-t-sm`,historyKey:`pbLastSDK`,tabs:[{title:`JS SDK`,language:`js`,value:`
function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request email change`,content:n},{title:`Confirm email change`,content:r}],o=store({activeActionIndex:0});return t.div({pbEvent:`apiPreviewEmailChange`,className:`content`},t.p(null,`Sends ${e.name} email change request.`),t.p(null,`On successful email change all previously issued auth tokens for the specific record will be invalidated (and the user will be marked as verified if not already).`),app.components.codeBlockTabs({className:`sdk-examples m-t-sm`,historyKey:`pbLastSDK`,tabs:[{title:`JS SDK`,language:`js`,value:`
import PocketBase from 'pocketbase';
const pb = new PocketBase('${i}');
@@ -16,7 +16,8 @@ function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request email change
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${e.name}').confirmEmailChange(
'EMAIL_CHANGE_TOKEN',
'YOUR_PASSWORD',
@@ -39,7 +40,8 @@ function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request email change
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${e.name}').confirmEmailChange(
'EMAIL_CHANGE_TOKEN',
'YOUR_PASSWORD',
@@ -53,6 +55,9 @@ function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request email change
'${i}/api/collections/${e.name}/request-email-change'
# Confirm email change
#
# note: all previous user auth tokens will be invalidated
# (and the user will be marked as verified if not already)
curl -X POST \\
-H 'Content-Type:application/json' \\
-d '{ "token":"...", "password":"" }' \\

View File

@@ -1,4 +1,4 @@
function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request password reset`,content:n},{title:`Confirm password reset`,content:r}],o=store({activeActionIndex:0});return t.div({pbEvent:`apiPreviewPasswordReset`,className:`content`},t.p(null,`Sends ${e.name} password reset email request.`),t.p(null,`On successful password reset all previously issued auth tokens for the specific record will be automatically invalidated.`),app.components.codeBlockTabs({className:`sdk-examples m-t-sm`,historyKey:`pbLastSDK`,tabs:[{title:`JS SDK`,language:`js`,value:`
function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request password reset`,content:n},{title:`Confirm password reset`,content:r}],o=store({activeActionIndex:0});return t.div({pbEvent:`apiPreviewPasswordReset`,className:`content`},t.p(null,`Sends ${e.name} password reset email request.`),t.p(null,`On successful password reset all previously issued auth tokens for the specific record will be invalidated (and the user will be marked as verified if not already).`),app.components.codeBlockTabs({className:`sdk-examples m-t-sm`,historyKey:`pbLastSDK`,tabs:[{title:`JS SDK`,language:`js`,value:`
import PocketBase from 'pocketbase';
const pb = new PocketBase('${i}');
@@ -11,7 +11,8 @@ function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request password res
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${e.name}').confirmPasswordReset(
'RESET_TOKEN',
'NEW_PASSWORD',
@@ -30,7 +31,8 @@ function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request password res
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${e.name}').confirmPasswordReset(
'RESET_TOKEN',
'NEW_PASSWORD',
@@ -44,6 +46,9 @@ function e(e){let i=app.utils.getApiExampleURL(),a=[{title:`Request password res
'${i}/api/collections/${e.name}/request-password-reset'
# Confirm password reset
#
# note: all previous user auth tokens will be invalidated
# (and the user will be marked as verified if not already)
curl -X POST \\
-H 'Content-Type:application/json' \\
-d '{ "token":"...", "password":"", "passwordConfirm":"" }' \\

View File

File diff suppressed because one or more lines are too long

2
ui/dist/index.html vendored
View File

@@ -13,7 +13,7 @@
<!-- prism -->
<script src="./libs/prism/prism.js" data-manual></script>
<script type="module" crossorigin src="./assets/index-Dko-neZT.js"></script>
<script type="module" crossorigin src="./assets/index-CphO81V5.js"></script>
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
<link rel="stylesheet" crossorigin href="./assets/index-DRWtZ-mO.css">
</head>

View File

@@ -20,6 +20,10 @@ export function docsAuthWithOTP(collection) {
},
// description
t.p(null, "Authenticate with an one-time/short-lived password (OTP)."),
t.p(
null,
"On successful authentication the user will be also marked as verified (if the OTP source is email and the user is not verified already).",
),
t.p(
null,
"Note that when requesting an OTP we return an ",

View File

@@ -19,7 +19,7 @@ export function docsEmailChange(collection) {
t.p(null, `Sends ${collection.name} email change request.`),
t.p(
null,
"On successful email change all previously issued auth tokens for the specific record will be automatically invalidated.",
"On successful email change all previously issued auth tokens for the specific record will be invalidated (and the user will be marked as verified if not already).",
),
app.components.codeBlockTabs({
className: "sdk-examples m-t-sm",
@@ -46,7 +46,8 @@ export function docsEmailChange(collection) {
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${collection.name}').confirmEmailChange(
'EMAIL_CHANGE_TOKEN',
'YOUR_PASSWORD',
@@ -83,7 +84,8 @@ export function docsEmailChange(collection) {
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${collection.name}').confirmEmailChange(
'EMAIL_CHANGE_TOKEN',
'YOUR_PASSWORD',
@@ -111,6 +113,9 @@ export function docsEmailChange(collection) {
'${baseURL}/api/collections/${collection.name}/request-email-change'
# Confirm email change
#
# note: all previous user auth tokens will be invalidated
# (and the user will be marked as verified if not already)
curl -X POST \\
-H 'Content-Type:application/json' \\
-d '{ "token":"...", "password":"" }' \\

View File

@@ -19,7 +19,7 @@ export function docsPasswordReset(collection) {
t.p(null, `Sends ${collection.name} password reset email request.`),
t.p(
null,
"On successful password reset all previously issued auth tokens for the specific record will be automatically invalidated.",
"On successful password reset all previously issued auth tokens for the specific record will be invalidated (and the user will be marked as verified if not already).",
),
app.components.codeBlockTabs({
className: "sdk-examples m-t-sm",
@@ -41,7 +41,8 @@ export function docsPasswordReset(collection) {
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${collection.name}').confirmPasswordReset(
'RESET_TOKEN',
'NEW_PASSWORD',
@@ -74,7 +75,8 @@ export function docsPasswordReset(collection) {
// (optional) in your custom confirmation page:
// ---
// note: after this call all previously issued auth tokens are invalidated
// note: all previous user auth tokens will be invalidated
// (and the user will be marked as verified if not already)
await pb.collection('${collection.name}').confirmPasswordReset(
'RESET_TOKEN',
'NEW_PASSWORD',
@@ -102,6 +104,9 @@ export function docsPasswordReset(collection) {
'${baseURL}/api/collections/${collection.name}/request-password-reset'
# Confirm password reset
#
# note: all previous user auth tokens will be invalidated
# (and the user will be marked as verified if not already)
curl -X POST \\
-H 'Content-Type:application/json' \\
-d '{ "token":"...", "password":"", "passwordConfirm":"" }' \\