Skip to content

Commit 4cd1fce

Browse files
author
Lasim
committed
feat: implement password reset functionality with token management and email notifications
1 parent c99184e commit 4cd1fce

File tree

18 files changed

+3269
-1
lines changed

18 files changed

+3269
-1
lines changed

services/backend/api-spec.json

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6677,6 +6677,308 @@
66776677
}
66786678
}
66796679
},
6680+
"/api/auth/email/forgot-password": {
6681+
"post": {
6682+
"summary": "Request password reset for email users",
6683+
"tags": [
6684+
"Authentication"
6685+
],
6686+
"description": "Sends a password reset email to users with email authentication. Always returns success for security (does not reveal if email exists). Requires email functionality to be enabled via global.send_mail setting. Reset tokens expire in 10 minutes.",
6687+
"requestBody": {
6688+
"content": {
6689+
"application/json": {
6690+
"schema": {
6691+
"type": "object",
6692+
"properties": {
6693+
"email": {
6694+
"type": "string",
6695+
"format": "email"
6696+
}
6697+
},
6698+
"required": [
6699+
"email"
6700+
],
6701+
"additionalProperties": false
6702+
}
6703+
}
6704+
},
6705+
"required": true
6706+
},
6707+
"responses": {
6708+
"200": {
6709+
"description": "Request processed successfully",
6710+
"content": {
6711+
"application/json": {
6712+
"schema": {
6713+
"type": "object",
6714+
"properties": {
6715+
"success": {
6716+
"type": "boolean",
6717+
"description": "Indicates if the request was processed successfully"
6718+
},
6719+
"message": {
6720+
"type": "string",
6721+
"description": "Success message (always returned for security)"
6722+
}
6723+
},
6724+
"required": [
6725+
"success",
6726+
"message"
6727+
],
6728+
"additionalProperties": false,
6729+
"description": "Request processed successfully"
6730+
}
6731+
}
6732+
}
6733+
},
6734+
"400": {
6735+
"description": "Bad Request - Invalid email format",
6736+
"content": {
6737+
"application/json": {
6738+
"schema": {
6739+
"type": "object",
6740+
"properties": {
6741+
"success": {
6742+
"type": "boolean",
6743+
"description": "Indicates if the operation was successful (false for errors)",
6744+
"default": false
6745+
},
6746+
"error": {
6747+
"type": "string",
6748+
"description": "Error message describing what went wrong"
6749+
}
6750+
},
6751+
"required": [
6752+
"error"
6753+
],
6754+
"additionalProperties": false,
6755+
"description": "Bad Request - Invalid email format"
6756+
}
6757+
}
6758+
}
6759+
},
6760+
"500": {
6761+
"description": "Internal Server Error - Password reset failed",
6762+
"content": {
6763+
"application/json": {
6764+
"schema": {
6765+
"type": "object",
6766+
"properties": {
6767+
"success": {
6768+
"type": "boolean",
6769+
"description": "Indicates if the operation was successful (false for errors)",
6770+
"default": false
6771+
},
6772+
"error": {
6773+
"type": "string",
6774+
"description": "Error message describing what went wrong"
6775+
}
6776+
},
6777+
"required": [
6778+
"error"
6779+
],
6780+
"additionalProperties": false,
6781+
"description": "Internal Server Error - Password reset failed"
6782+
}
6783+
}
6784+
}
6785+
},
6786+
"503": {
6787+
"description": "Service Unavailable - Email functionality disabled",
6788+
"content": {
6789+
"application/json": {
6790+
"schema": {
6791+
"type": "object",
6792+
"properties": {
6793+
"success": {
6794+
"type": "boolean",
6795+
"description": "Indicates if the operation was successful (false for errors)",
6796+
"default": false
6797+
},
6798+
"error": {
6799+
"type": "string",
6800+
"description": "Error message describing what went wrong"
6801+
}
6802+
},
6803+
"required": [
6804+
"error"
6805+
],
6806+
"additionalProperties": false,
6807+
"description": "Service Unavailable - Email functionality disabled"
6808+
}
6809+
}
6810+
}
6811+
}
6812+
}
6813+
}
6814+
},
6815+
"/api/auth/email/reset-password": {
6816+
"post": {
6817+
"summary": "Reset password using reset token",
6818+
"tags": [
6819+
"Authentication"
6820+
],
6821+
"description": "Resets the password for email users using a valid reset token. The token must be valid and not expired (10-minute expiration). After successful reset, all user sessions are invalidated for security. Only works for users with email authentication.",
6822+
"requestBody": {
6823+
"content": {
6824+
"application/json": {
6825+
"schema": {
6826+
"type": "object",
6827+
"properties": {
6828+
"token": {
6829+
"type": "string",
6830+
"minLength": 1
6831+
},
6832+
"new_password": {
6833+
"type": "string",
6834+
"minLength": 8,
6835+
"maxLength": 100
6836+
}
6837+
},
6838+
"required": [
6839+
"token",
6840+
"new_password"
6841+
],
6842+
"additionalProperties": false
6843+
}
6844+
}
6845+
},
6846+
"required": true
6847+
},
6848+
"responses": {
6849+
"200": {
6850+
"description": "Password reset successfully",
6851+
"content": {
6852+
"application/json": {
6853+
"schema": {
6854+
"type": "object",
6855+
"properties": {
6856+
"success": {
6857+
"type": "boolean",
6858+
"description": "Indicates if the password reset was successful"
6859+
},
6860+
"message": {
6861+
"type": "string",
6862+
"description": "Success message"
6863+
}
6864+
},
6865+
"required": [
6866+
"success",
6867+
"message"
6868+
],
6869+
"additionalProperties": false,
6870+
"description": "Password reset successfully"
6871+
}
6872+
}
6873+
}
6874+
},
6875+
"400": {
6876+
"description": "Bad Request - Invalid token, expired token, or invalid password",
6877+
"content": {
6878+
"application/json": {
6879+
"schema": {
6880+
"type": "object",
6881+
"properties": {
6882+
"success": {
6883+
"type": "boolean",
6884+
"description": "Indicates if the operation was successful (false for errors)",
6885+
"default": false
6886+
},
6887+
"error": {
6888+
"type": "string",
6889+
"description": "Error message describing what went wrong"
6890+
}
6891+
},
6892+
"required": [
6893+
"error"
6894+
],
6895+
"additionalProperties": false,
6896+
"description": "Bad Request - Invalid token, expired token, or invalid password"
6897+
}
6898+
}
6899+
}
6900+
},
6901+
"403": {
6902+
"description": "Forbidden - User not eligible for password reset",
6903+
"content": {
6904+
"application/json": {
6905+
"schema": {
6906+
"type": "object",
6907+
"properties": {
6908+
"success": {
6909+
"type": "boolean",
6910+
"description": "Indicates if the operation was successful (false for errors)",
6911+
"default": false
6912+
},
6913+
"error": {
6914+
"type": "string",
6915+
"description": "Error message describing what went wrong"
6916+
}
6917+
},
6918+
"required": [
6919+
"error"
6920+
],
6921+
"additionalProperties": false,
6922+
"description": "Forbidden - User not eligible for password reset"
6923+
}
6924+
}
6925+
}
6926+
},
6927+
"500": {
6928+
"description": "Internal Server Error - Password reset failed",
6929+
"content": {
6930+
"application/json": {
6931+
"schema": {
6932+
"type": "object",
6933+
"properties": {
6934+
"success": {
6935+
"type": "boolean",
6936+
"description": "Indicates if the operation was successful (false for errors)",
6937+
"default": false
6938+
},
6939+
"error": {
6940+
"type": "string",
6941+
"description": "Error message describing what went wrong"
6942+
}
6943+
},
6944+
"required": [
6945+
"error"
6946+
],
6947+
"additionalProperties": false,
6948+
"description": "Internal Server Error - Password reset failed"
6949+
}
6950+
}
6951+
}
6952+
},
6953+
"503": {
6954+
"description": "Service Unavailable - Email functionality disabled",
6955+
"content": {
6956+
"application/json": {
6957+
"schema": {
6958+
"type": "object",
6959+
"properties": {
6960+
"success": {
6961+
"type": "boolean",
6962+
"description": "Indicates if the operation was successful (false for errors)",
6963+
"default": false
6964+
},
6965+
"error": {
6966+
"type": "string",
6967+
"description": "Error message describing what went wrong"
6968+
}
6969+
},
6970+
"required": [
6971+
"error"
6972+
],
6973+
"additionalProperties": false,
6974+
"description": "Service Unavailable - Email functionality disabled"
6975+
}
6976+
}
6977+
}
6978+
}
6979+
}
6980+
}
6981+
},
66806982
"/api/auth/profile/update": {
66816983
"put": {
66826984
"summary": "Update user profile",

0 commit comments

Comments
 (0)