Replies: 3 comments 6 replies
-
If you really need the auth data on confirm verification you can override the default response using the // pb_hooks/main.pb.js
onRecordAfterConfirmVerificationRequest((e) => {
return $apis.recordAuthResponse($app, e.httpContext, e.record, null);
}) edit: replaced onRecordAfterRequestVerificationRequest with onRecordAfterConfirmVerificationRequest |
Beta Was this translation helpful? Give feedback.
-
I was thinking more like a way to get the user data directly? Like something like get data of user as an admin? |
Beta Was this translation helpful? Give feedback.
-
What I ended u doing, was storing into localstorage/cookie (your choice) the users's email+pass from the REGISTRATION FORM. And retrieve them on the next "aerify-email" trigger/page. async function submitForm() {
await $pb.collection(`users`).create({
username: username.value,
email: email.value,
password: password.value,
passwordConfirm: passwordConfirm.value,
}).then(() => {
// account created - and email sent
localStorage.setItem("pb_login_email", email.value)
localStorage.setItem("pb_login_password", password.value)
}).catch((e) => {
//BIG ERROR WARNING
})
} And then, on verification page/script/endpoint: try {
await $pb.collection(`users`).confirmVerification(route.query?.token)
await $pb.collection(`users`).authWithPassword(
localStorage.getItem("pb_login_email"),
localStorage.getItem("pb_login_password")
)
// CLEAR THE STORAGE
localStorage.removeItem("pb_login_email"),
localStorage.removeItem("pb_login_password")
navigateTo('/');
} catch (e) {
showError({
statusCode: 400,
statusMessage: e.data?.data?.token ? e.data.data.token.message : e.message,
})
} |
Beta Was this translation helpful? Give feedback.
-
Hiya, so currently im using the SSR version of pocketbase (no authstore, just put the data in cookies and get from there on all requests) now the flow is usually
/register -> /login (cookie added) -> Verified -> Dash || Not Verified -> /verify -> /login -> /dash
The reason you need to login again after verify is cause i dont know how to get the user data again after confirm verification.. but this is just a long login flow.. is there any way for me to get the user data after confirm verification which i can yeet into the cookies again?
https://github.com/Arinji2/vibeify
Beta Was this translation helpful? Give feedback.
All reactions