This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { r as redirect } from './index-wpIsICWW.js';
|
||||
|
||||
const load = async ({ url, locals }) => {
|
||||
if (locals.user) {
|
||||
throw redirect(303, url.searchParams.get("redirectTo") ?? "/");
|
||||
}
|
||||
return {
|
||||
redirectTo: url.searchParams.get("redirectTo") ?? "",
|
||||
error: null
|
||||
};
|
||||
};
|
||||
const actions = {
|
||||
default: async ({ request, locals, url }) => {
|
||||
const formData = await request.formData();
|
||||
const email = String(formData.get("email") ?? "").trim();
|
||||
const password = String(formData.get("password") ?? "");
|
||||
const redirectTo = String(formData.get("redirectTo") ?? "").trim() || "/";
|
||||
if (!email || !password) {
|
||||
return {
|
||||
redirectTo,
|
||||
error: "Email and password are required."
|
||||
};
|
||||
}
|
||||
try {
|
||||
await locals.pb.collection("users").authWithPassword(email, password);
|
||||
} catch (err) {
|
||||
const message = err && typeof err === "object" && "message" in err ? String(err.message) : "Invalid email or password.";
|
||||
return {
|
||||
redirectTo,
|
||||
error: message
|
||||
};
|
||||
}
|
||||
throw redirect(303, redirectTo);
|
||||
}
|
||||
};
|
||||
|
||||
var _page_server_ts = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
actions: actions,
|
||||
load: load
|
||||
});
|
||||
|
||||
const index = 8;
|
||||
let component_cache;
|
||||
const component = async () => component_cache ??= (await import('./_page.svelte-CkSLjmVD.js')).default;
|
||||
const server_id = "src/routes/login/+page.server.ts";
|
||||
const imports = ["_app/immutable/nodes/8.CQbjEMpm.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/BfGs3WDN.js","_app/immutable/chunks/Dc4kZMuG.js","_app/immutable/chunks/BlBMKpZ6.js","_app/immutable/chunks/CQe9XmLJ.js","_app/immutable/chunks/C2sKwo1m.js","_app/immutable/chunks/BIDFgmbM.js","_app/immutable/chunks/_58MWSf2.js","_app/immutable/chunks/CW15Ts-p.js","_app/immutable/chunks/DTyTeadx.js","_app/immutable/chunks/D7710T35.js","_app/immutable/chunks/DecArsLH.js","_app/immutable/chunks/By9q4dnk.js","_app/immutable/chunks/BSLeMsiy.js","_app/immutable/chunks/BcNtEwNR.js","_app/immutable/chunks/C3gUTv4t.js"];
|
||||
const stylesheets = [];
|
||||
const fonts = [];
|
||||
|
||||
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
|
||||
//# sourceMappingURL=8-4XSzWPH3.js.map
|
||||
Reference in New Issue
Block a user