curl --request POST \
--url https://api.vellaro.io/api/v1/users/me/change-password \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"old_password": "<string>",
"new_password": "<string>"
}
'import requests
url = "https://api.vellaro.io/api/v1/users/me/change-password"
payload = {
"old_password": "<string>",
"new_password": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({old_password: '<string>', new_password: '<string>'})
};
fetch('https://api.vellaro.io/api/v1/users/me/change-password', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vellaro.io/api/v1/users/me/change-password",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'old_password' => '<string>',
'new_password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vellaro.io/api/v1/users/me/change-password"
payload := strings.NewReader("{\n \"old_password\": \"<string>\",\n \"new_password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vellaro.io/api/v1/users/me/change-password")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"old_password\": \"<string>\",\n \"new_password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vellaro.io/api/v1/users/me/change-password")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"old_password\": \"<string>\",\n \"new_password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Change Password
Change the current user’s password (requires old_password verification).
Allineato a POST /auth/change-password: almeno 8 caratteri, audit
auth.password_changed e avviso di sicurezza solo a commit avvenuto.
Rotazione delle sessioni SOLO su richiesta (LB1-03). Con l’header
X-Session-Rotation: 1 (oppure X-Refresh-Mode: cookie) il cambio chiude
tutte le sessioni dell’account (HUBFE-02/M8) e la risposta porta, oltre a
message, access_token, token_type e (salvo modalità cookie)
refresh_token nuovi per QUESTO dispositivo, che il client deve adottare.
Senza header la risposta è quella di sempre, {message}, e nessuna
sessione viene revocata: i client dedicati e l’app mobile scartano il
corpo, e una revoca li avrebbe buttati fuori (e trattati da ospiti) subito
dopo il cambio.
curl --request POST \
--url https://api.vellaro.io/api/v1/users/me/change-password \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"old_password": "<string>",
"new_password": "<string>"
}
'import requests
url = "https://api.vellaro.io/api/v1/users/me/change-password"
payload = {
"old_password": "<string>",
"new_password": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({old_password: '<string>', new_password: '<string>'})
};
fetch('https://api.vellaro.io/api/v1/users/me/change-password', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vellaro.io/api/v1/users/me/change-password",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'old_password' => '<string>',
'new_password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vellaro.io/api/v1/users/me/change-password"
payload := strings.NewReader("{\n \"old_password\": \"<string>\",\n \"new_password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.vellaro.io/api/v1/users/me/change-password")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"old_password\": \"<string>\",\n \"new_password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vellaro.io/api/v1/users/me/change-password")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"old_password\": \"<string>\",\n \"new_password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Autorizzazioni
Corpo
Body of POST /users/me/change-password (requires the current password).
At least 8 characters, like POST /auth/change-password, signup, reset and the staff accounts created by the admin. It used to accept 6, so the profile page was the one way below the platform minimum; a short password is the 422 validation error, as on /auth.
Risposta
Successful Response