mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 21:36:26 -08:00
clear up internal libs (@Jack5079)
This commit is contained in:
parent
1ed1acca1c
commit
9a589d3638
|
@ -35,23 +35,22 @@ export interface Account {
|
|||
* @returns A Promise which returns the new account's ID
|
||||
*/
|
||||
|
||||
export function create(username:string,pwd:string,admin:boolean=false):Promise<string> {
|
||||
return new Promise((resolve,reject) => {
|
||||
let accId = crypto.randomBytes(12).toString("hex")
|
||||
export async function create(username:string,pwd:string,admin:boolean=false):Promise<string> {
|
||||
let accId = crypto.randomBytes(12).toString("hex")
|
||||
|
||||
Accounts.push(
|
||||
{
|
||||
id: accId,
|
||||
username: username,
|
||||
password: password.hash(pwd),
|
||||
files: [],
|
||||
admin: admin,
|
||||
defaultFileVisibility: "public"
|
||||
}
|
||||
)
|
||||
Accounts.push(
|
||||
{
|
||||
id: accId,
|
||||
username: username,
|
||||
password: password.hash(pwd),
|
||||
files: [],
|
||||
admin: admin,
|
||||
defaultFileVisibility: "public"
|
||||
}
|
||||
)
|
||||
|
||||
save().then(() => resolve(accId))
|
||||
})
|
||||
await save()
|
||||
return accId
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,19 +27,14 @@ transport =
|
|||
* @returns Promise which resolves to the output from nodemailer.transport.sendMail
|
||||
*/
|
||||
export function sendMail(to: string, subject: string, content: string) {
|
||||
return new Promise((resolve,reject) => {
|
||||
transport.sendMail({
|
||||
to,
|
||||
subject,
|
||||
"from": mailConfig.send.from,
|
||||
"html": `<span style="font-size:x-large;font-weight:600;">monofile <span style="opacity:0.5">accounts</span></span><br><span style="opacity:0.5">Gain control of your uploads.</span><hr><br>${
|
||||
content
|
||||
.replace(/\<span username\>/g, `<span code><span style="color:#DDAA66;padding-right:3px;">@</span>`)
|
||||
.replace(/\<span code\>/g,`<span style="font-family:monospace;padding:3px 5px 3px 5px;border-radius:8px;background-color:#1C1C1C;color:#DDDDDD;">`)
|
||||
}<br><br><span style="opacity:0.5">If you do not believe that you are the intended recipient of this email, please disregard this message.</span>`
|
||||
}, (err, info) => {
|
||||
if (err) reject(err)
|
||||
else resolve(info)
|
||||
})
|
||||
return transport.sendMail({
|
||||
to,
|
||||
subject,
|
||||
"from": mailConfig.send.from,
|
||||
"html": `<span style="font-size:x-large;font-weight:600;">monofile <span style="opacity:0.5">accounts</span></span><br><span style="opacity:0.5">Gain control of your uploads.</span><hr><br>${
|
||||
content
|
||||
.replace(/\<span username\>/g, `<span code><span style="color:#DDAA66;padding-right:3px;">@</span>`)
|
||||
.replace(/\<span code\>/g,`<span style="font-family:monospace;padding:3px 5px 3px 5px;border-radius:8px;background-color:#1C1C1C;color:#DDDDDD;">`)
|
||||
}<br><br><span style="opacity:0.5">If you do not believe that you are the intended recipient of this email, please disregard this message.</span>`
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue