From 2df13bc59989d3e31bdc84ae3553e4ec4927c8a6 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Thu, 24 Jul 2025 21:04:15 +0500 Subject: [PATCH] password_reset docs incomplete --- docs/password_reset.md | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 docs/password_reset.md diff --git a/docs/password_reset.md b/docs/password_reset.md new file mode 100644 index 0000000..ef907b8 --- /dev/null +++ b/docs/password_reset.md @@ -0,0 +1,59 @@ +## Password reset + + +## Request for OTP +#### You will need to provide existing account phone number in this request +```bash +curl --request POST \ + --url https://api.fenaka.mv/auth/password-reset/request \ + --header 'authorization: Bearer TOKEN' \ + --header 'content-type: application/json' \ + --data '{"mobile":"PHONE_NUMBER"}' +``` +- This should send a 1 digit OTP to phone number you requested, but at the time of writing this document fenaka SMS seems to be broken + +You will also get a "Set-Cookie" in reponse header, which will be needed for submitting OTP, store this header somewhere for later user +``` +Set-Cookie: connect.sid=; HttpOnly; Path=/``` +(you only need the part before the first ";") + +## HTTP 200 +- You will just the requested phone number in json +```json +{ + "mobile": "" +} +``` + +## HTTP 404 +- You will get this reponse if there is no registered account +```json +{ + "error": "not-found" +} +``` +## Submit OTP + +I CANNOT TEST THIS AT THE TIME OF WRITING THIS DOCUMENT BECAUSE SMS IS NOT WORKING \ +but here is how to: +```bash +curl --request POST \ + --url https://api.fenaka.mv/auth/verify-otp/password-reset \ + --header 'authorization: Bearer TOKEN' \ + --header 'content-type: application/json' \ + --data '{"otp":"1111"}' +``` + +## HTTP 422 +```json +{ + "errors": [ + { + "value": "1111", + "msg": "invalid otp", + "param": "otp", + "location": "body" + } + ] +} +```