i got locked out of the admin dashboard (totally my fault), and i can't remember my password. i'm running the project manually and when i fire up the server, i get this error : ' (payload): There was a problem setting up the mock email handler'. it's my first time working with payload . with any headless CMS for that matter. i'd really appreciate any help i can get. thanks in advance
this is my repo if it'll help :
https://github.com/neo1415/nextjs-custom-serverI've had a similar issue with the same code. Planning to revisit today. Not sure I can help but at least provide more data points.
I think I removed the admin user from the DB directly then tried to reinitialize a new user to get back in. Obviously that's not a good solution.
Oh, thank you, how did you go about that then ?
"use strict";
var
importDefault = (this && this.importDefault)
function (mod) {'Payload CMS',
fromAddress: emailConfig.fromAddress || 'info@payloadcms.com',
auth: {
user: testAccount.user,
pass: testAccount.pass,
},
};
return {
account: testAccount,
transport: nodemailer_1.default.createTransport(smtpOptions),
};
};
exports.default = mockEmailHandler;
//# sourceMappingURL=mockHandler.js.map
this is how my mockHandler looks like
Hey @Daniel502 I've got myself locked out many many times.
If you are okay with losing your existing users, you can do what @nball said and delete your user collection from the database. To do this, you need to open up MongoDB, connect and find your
nem-health
database, right click on the Users collection and hit
drop
. Then navigate to
localhost:3000/admin
and you should be prompted to create a new first user.
Or we can go the mock email route and use the ethereal capture service. Add this to your payload.init (the fromName/address can be any value):
payload.init({
email: {
fromName: 'Admin',
fromAddress: 'admin@example.com',
logMockCredentials: true,
},
// ...
});
Restart your server - this time you will see mock credentials in your terminal, you will need these later.
Navigate back to the admin login in your browser, click
Forgot Passwordand follow the instructions.
Now head to the mock email provider:
https://ethereal.emailand use the credentials that were output to your terminal when you started the server. You should see the
Reset Passwordemail and be able to follow the link to reset your password.
thank you so much for replying , i really appreciate it. the thing is i don't have a payload.init in my code .
"use strict";
var
importDefault = (this && this.importDefault)
function (mod) {'Payload CMS',
fromAddress: emailConfig.fromAddress || 'info@payloadcms.com',
auth: {
user: testAccount.user,
pass: testAccount.pass,
},
};
return {
account: testAccount,
transport: nodemailer_1.default.createTransport(smtpOptions),
};
};
exports.default = mockEmailHandler;
//# sourceMappingURL=mockHandler.js.map
this is the current code.
In the repo you shared it looks like you have payload.init() here?
https://github.com/neo1415/nextjs-custom-server/blob/master/server.tsThanks so much , I'm in again. It worked . Blessings
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.