mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 13:36:25 -08:00
mail-unlink: initial
This commit is contained in:
parent
7d3b1b5703
commit
6b59732aa1
|
@ -314,6 +314,16 @@ authRoutes.get("/confirm_email/:code", requiresAccount, (req,res) => {
|
|||
}
|
||||
})
|
||||
|
||||
authRoutes.post("/remove_email", requiresAccount, (req,res) => {
|
||||
let acc = res.locals.acc as Accounts.Account
|
||||
|
||||
if (acc.email) {
|
||||
delete acc.email;
|
||||
Accounts.save()
|
||||
}
|
||||
else ServeError(res, 400, "email not attached")
|
||||
})
|
||||
|
||||
let pwReset = new Map<string, {code: string, expiry: NodeJS.Timeout, requestedAt:number}>()
|
||||
let prcIdx = new Map<string, string>()
|
||||
|
||||
|
|
|
@ -115,6 +115,35 @@ export function forgotPassword(optPicker) {
|
|||
})
|
||||
}
|
||||
|
||||
export function emailPotentialRemove(optPicker) {
|
||||
optPicker.picker("What would you like to do?",[
|
||||
{
|
||||
name: "Set a new email",
|
||||
icon: "/static/assets/icons/mail.svg",
|
||||
id: true
|
||||
},
|
||||
{
|
||||
name: "Disconnect email",
|
||||
icon: "/static/assets/icons/delete.svg",
|
||||
description: "",
|
||||
id: "disconnect"
|
||||
}
|
||||
]).then((exp) => {
|
||||
if (exp && exp.selected) {
|
||||
switch (exp.selected) {
|
||||
case "set":
|
||||
emailChange(optPicker);
|
||||
case "disconnect":
|
||||
fetch("/auth/remove_email", {method: "POST"}).then((response) => {
|
||||
if (response.status != 200) {
|
||||
optPicker.picker(`${response.status} ${response.headers.get("x-backup-status-message") || response.statusText || ""}`,[])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function emailChange(optPicker) {
|
||||
optPicker.picker("Change email",[
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue