Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-strapi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 0574f7ae
authored
2024-07-09 20:13:17 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
b7602474
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
src/api/end-user/controllers/end-user.js
src/api/end-user/routes/custom-routes.js
src/api/end-user/controllers/end-user.js
View file @
0574f7a
...
...
@@ -111,4 +111,34 @@ module.exports = createCoreController("api::end-user.end-user", () => ({
message
:
"OTP sent successfully"
,
});
},
async
resetPassword
(
ctx
)
{
console
.
log
(
ctx
.
request
.
body
);
const
{
email
,
password
}
=
ctx
.
request
.
body
;
const
currentUser
=
await
strapi
.
query
(
"plugin::users-permissions.user"
)
.
findOne
({
populate
:
[
"user"
],
where
:
{
$and
:
[{
email
:
email
}],
},
});
// Check if its already existing in vendor entity
console
.
log
(
"currentUser"
,
currentUser
);
await
strapi
.
entityService
.
update
(
"plugin::users-permissions.user"
,
currentUser
.
id
,
{
data
:
{
password
:
`
${
password
}
`
,
},
}
);
ctx
.
send
({
ok
:
true
,
message
:
"New password updated"
,
});
},
}));
src/api/end-user/routes/custom-routes.js
View file @
0574f7a
...
...
@@ -8,6 +8,14 @@ const routes = {
// some configuration...
}
},
{
method
:
"POST"
,
path
:
"/end-user/reset-password"
,
handler
:
"api::end-user.end-user.resetPassword"
,
config
:
{
// some configuration...
}
},
]
};
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment