This commit is contained in:
May 2023-03-01 11:13:25 -08:00
parent 94f416bbc4
commit cc881c8995
2 changed files with 2 additions and 35 deletions

View file

@ -1,33 +0,0 @@
import { fetchAccountData } from "../stores.mjs"
export function pwdChng(optPicker) {
optPicker.picker("Change password",[
{
name: "New password",
icon: "/static/assets/icons/change_password.svg",
id: "password",
inputSettings: {
password: true
}
},
{
name: "OK",
icon: "/static/assets/icons/update.svg",
description: "This will log you out of all sessions",
id: true
}
]).then((exp) => {
if (exp && exp.selected) {
fetch(`/auth/change_password`,{method:"POST", body:JSON.stringify({
password:exp.password
})}).then((response) => {
if (response.status != 200) {
optPicker.picker(`${response.status} ${response.statusText}`,[])
}
fetchAccountData()
})
}
})
}

View file

@ -5,7 +5,7 @@
import { account, fetchAccountData, serverStats } from "../stores.mjs";
import { fade } from "svelte/transition";
import OptionPicker from "../prompts/OptionPicker.svelte";
import { pwdChng } from "../prompts/passwordChange";
import * as accOpts from "../prompts/account";
let targetAction
let inProgress
@ -124,7 +124,7 @@
<p>Change username</p>
</button>
<button on:click={() => pwdChng(optPicker)}>
<button on:click={() => accOpts.pwdChng(optPicker)}>
<img src="/static/assets/icons/change_password.svg" alt="change password">
<p>Change password<span><br />You will be logged out of all sessions</span></p>
</button>