feat: add password changing

This commit is contained in:
Xyphyn committed 2023-09-26 18:19:16 -07:00
1 parent 505175277c
commit 76f22dab5c
12 files changed
+138 -54

No files matched your search

+14 -1
View File
@@ -135,7 +135,7 @@ export async function setUser(jwt: string, inst: string, username: string) {
return {
profile: id,
profiles: [...pd.profiles, newProfile],
profiles: [newProfile, ...pd.profiles],
}
})
@@ -227,6 +227,19 @@ instance.subscribe(async (i) => {
} catch (e) {}
})
export function updateJwt(id: number, newJwt: string) {
const pd = get(profileData)
let prof = pd.profiles.find((p) => p.id == id)
if (!prof) return
prof = serializeUser(prof)
prof.jwt = newJwt
profileData.update((p) => ({ ...p, profile: id }))
profile.update(() => prof)
}
export async function setUserID(id: number) {
const pd = get(profileData)
if (id == -1) {