Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
30 lines
1.0 KiB
Plaintext
30 lines
1.0 KiB
Plaintext
import { status as httpStatus } from 'http-status';
|
|
import { getRequestCollection } from '../../utilities/getRequestEntity.js';
|
|
import { headersWithCors } from '../../utilities/headersWithCors.js';
|
|
import { unlockOperation } from '../operations/unlock.js';
|
|
export const unlockHandler = async (req)=>{
|
|
const collection = getRequestCollection(req);
|
|
const { t } = req;
|
|
const authData = collection.config.auth?.loginWithUsername !== false ? {
|
|
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
username: typeof req.data?.username === 'string' ? req.data.username : ''
|
|
} : {
|
|
email: typeof req.data?.email === 'string' ? req.data.email : ''
|
|
};
|
|
await unlockOperation({
|
|
collection,
|
|
data: authData,
|
|
req
|
|
});
|
|
return Response.json({
|
|
message: t('general:success')
|
|
}, {
|
|
headers: headersWithCors({
|
|
headers: new Headers(),
|
|
req
|
|
}),
|
|
status: httpStatus.OK
|
|
});
|
|
};
|
|
|
|
//# sourceMappingURL=unlock.js.map |