shinesolutions / ruby_aem

Ruby client for Adobe Experience Manager (AEM) API
Apache License 2.0
13 stars 7 forks source link

Add user#change_password error handling #5

Closed cliffano closed 7 years ago

cliffano commented 7 years ago

user#change_password method responds with status 200 even if the request fails.

Response handler needs to be improved to check response body for better success/failure indicator.

Sample failure message:

<td><font color="red">Failed to change password for user 'admin': Failed to change password: Old password does not match.</font></td>

Sample success message:

<td><font color="green">Password successfully changed.</font></td>

Sample invalid authentication: (spoiler alert: it's responding with 200 instead of 401)

POST /crx/explorer/ui/setpassword.jsp?old=somepassword&plain=somenewpassword&verify=somenewpassword HTTP/1.1
Host: localhost:4502
User-Agent: Swagger-Codegen/0.9.4/ruby
Content-Type: application/json
Accept: text/plain
Authorization: Basic R1JPTzpyZXNvdXJjZVs6b2xkX3Bhc3N3b3JkXQ==
Content-Length: 0

HTTP/1.1 200 OK
Date: Thu, 23 Feb 2017 22:54:38 GMT
Content-Type: text/html
Set-Cookie: JSESSIONID=1nllpyl8ua8xcw8rhp5cnelvj;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Length: 0
cliffano commented 7 years ago

Fix will be included in ruby_aem 1.0.19 .