add unenroll to api home page, minor changes
This commit is contained in:
7
mod.ts
7
mod.ts
@@ -131,13 +131,14 @@ Deno.serve({ port: config.api.port }, async (req) => {
|
||||
if (!(await verify(body.pin, loginMatch[0].hash))) return genericResponse(STATUS_CODE.Forbidden, 'Invalid name/PIN combination.');
|
||||
const id = loginMatch[0].id;
|
||||
const email = loginMatch[0].email;
|
||||
const hasEmail = email.length > 0;
|
||||
const hasEmail = (email ?? '').length > 0;
|
||||
const deleteCode = loginMatch[0].deleteCode;
|
||||
const deleteCodeSet = (deleteCode ?? '').length > 0;
|
||||
|
||||
switch (req.method) {
|
||||
case 'POST':
|
||||
if (path === '/auth') {
|
||||
return genericResponse(STATUS_CODE.OK, JSON.stringify({ id, hasEmail }));
|
||||
return genericResponse(STATUS_CODE.OK, JSON.stringify({ id, hasEmail, deleteCodeSet }));
|
||||
} else if (path === '/create') {
|
||||
if (body.planName.trim().length > 200) return genericResponse(STATUS_CODE.BadRequest, 'Name too long.');
|
||||
if (body.folder.trim() && body.folder.trim().length > 200) return genericResponse(STATUS_CODE.BadRequest, 'Folder name too long.');
|
||||
@@ -258,7 +259,7 @@ Deno.serve({ port: config.api.port }, async (req) => {
|
||||
fromAddress: config.email.address,
|
||||
toAddress: email,
|
||||
subject: 'XIVPlan+DB Delete Code',
|
||||
content: `Notice: account deletion is permanent and will delete all plans saved under your account.<br/><br/>Please use the following Delete Code to delete your account:<br/><br/>${newDeleteCode}`,
|
||||
content: `Notice: Account deletion is permanent and will permanently delete all plans saved under your account.<br/><br/>Please use the following Delete Code to delete your account:<br/><br/>${newDeleteCode}`,
|
||||
}),
|
||||
}).catch(() => {
|
||||
failed = true;
|
||||
|
||||
Reference in New Issue
Block a user