Hello everyone,

I'm looking at migrated from v8 to v9 but noticed that when using the API 
<https://packetfence.org/doc/api/#/operations/default/get_user__user_id__password>
 
/user/{user_id}/password<https://packetfence.org/doc/api/#/operations/default/get_user__user_id__password>
 no longer returns the password hash. Is this intended behaviour or is there 
still a way of getting the hash via API?

I was able to replicate this behavior with freshly imported ZEN between the 
different versions.

v8
[root@PacketFence-ZEN ~]# curl -X GET 
"https://127.0.0.1:9999/api/v1/user/"apitest"/password"; \
> -H  "accept: application/json" \
> -H  "Authorization: 
> 1dd8396fcc6f3c5e28c02f9ace86ff320cb38c5162f9bc1ce1b7ca6e4cfc908e" \
> --insecure |
> python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   943  100   943    0     0   3531      0 --:--:-- --:--:-- --:--:--  3545
{
    "item": {
        "access_duration": null,
        "access_level": "NONE",
        "address": null,
        "anniversary": null,
        "apartment_number": null,
        "birthday": null,
        "building_number": null,
        "can_sponsor": "0",
        "category": null,
        "cell_phone": null,
        "company": null,
        "custom_field_1": null,
        "custom_field_2": null,
        "custom_field_3": null,
        "custom_field_4": null,
        "custom_field_5": null,
        "custom_field_6": null,
        "custom_field_7": null,
        "custom_field_8": null,
        "custom_field_9": null,
        "email": "[email protected]",
        "expiration": "2019-07-31 00:00:00",
        "firstname": null,
        "gender": null,
        "lang": null,
        "lastname": null,
        "login_remaining": null,
        "nickname": null,
        "nodes": null,
        "notes": null,
        "password": 
"{bcrypt}$2a$08$XzSI/8IVDGGxXR5BpyDczO//MSoARh4515PMmFSJ2Xq.mkhSwRTGa",
        "pid": "apitest",
        "portal": null,
        "potd": "no",
        "psk": null,
        "room_number": null,
        "source": null,
        "sponsor": "admin",
        "telephone": null,
        "tenant_id": "1",
        "title": null,
        "unregdate": "0000-00-00 00:00:00",
        "valid_from": "2019-07-27 00:00:00",
        "work_phone": null
    },
    "status": 200
}


v9
[root@PacketFence-ZEN ~]# curl -X POST "https://127.0.0.1:9999/api/v1/login"; \
> -H  "accept: application/json" \
> -H  "Content-Type: application/json" \
> -d "{\"username\":\"admin\",\"password\":\"synergy\"}" \
> --insecure |
> python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   117  100    76  100    41    394    212 --:--:-- --:--:-- --:--:--   395
{
    "token": "7c177e75128314a0c3d99f50e3454f21a8ddf286915810e69a95d13a8d4a6a73"
}
You have new mail in /var/spool/mail/root
[root@PacketFence-ZEN ~]# ^C
[root@PacketFence-ZEN ~]#
[root@PacketFence-ZEN ~]#
[root@PacketFence-ZEN ~]# curl -X GET 
"https://127.0.0.1:9999/api/v1/user/"apitest"/password"; \
> -H  "accept: application/json" \
> -H  "Authorization: 
> 7c177e75128314a0c3d99f50e3454f21a8ddf286915810e69a95d13a8d4a6a73" \
> --insecure |
> python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   825  100   825    0     0   4401      0 --:--:-- --:--:-- --:--:--  4411
{
    "item": {
        "access_duration": null,
        "access_level": "NONE",
        "address": "",
        "anniversary": "",
        "apartment_number": "",
        "birthday": "",
        "building_number": "",
        "can_sponsor": "0",
        "category": null,
        "category_id": null,
        "cell_phone": "",
        "company": "",
        "custom_field_1": "",
        "custom_field_2": "",
        "custom_field_3": "",
        "custom_field_4": "",
        "custom_field_5": "",
        "custom_field_6": "",
        "custom_field_7": "",
        "custom_field_8": "",
        "custom_field_9": "",
        "email": "[email protected]",
        "expiration": "2019-07-31 00:00:00",
        "firstname": "",
        "gender": "",
        "lang": null,
        "lastname": "",
        "login_remaining": null,
        "nickname": "",
        "nodes": null,
        "notes": "",
        "pid": "apitest",
        "portal": null,
        "potd": "no",
        "psk": "",
        "room_number": "",
        "source": null,
        "sponsor": "admin",
        "telephone": "",
        "tenant_id": "1",
        "title": "",
        "unregdate": "0000-00-00 00:00:00",
        "valid_from": "2019-07-27 00:00:00",
        "work_phone": ""
    },
    "status": 200
}

Thank you,
James
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users
  • [PacketFence-users] API /user... James Jakimowicz via PacketFence-users

Reply via email to