While that might work (I have no idea if it really will and would be inclined to think it’s not possible), I’d strongly advise against it. The email is important for users to be able to reset their password or confirm the email in the first place. Thus, changing that would be a bad idea.
Wow! Thanks! I tried but kept getting an error, so I customized a login and came to this. So , you’re saying assign the role and it will automate right? But I have to go live and do it. I can’t troubleshoot it from local host.
I’ll explain the flow how Role Based Access Control will work:
A user signs-up → they have no role set → they subscribe to a premium plan → you handle the payment and trigger a serverless function once they’ve successfully paid → upgrade their role in the function → return the user data with the updated role and send a cookie named nf_jwt → RBAC will match this cookie to redirect in the future.
It sounds so encouraging, and I wish it did ring a bell but it doesn’t lol. I do know I can adjust my form for an initial sign up, and I do have a premium page where they have to pay in crypto. When you say return function is that regarding the return function in this code? I’ve coded a mean site but have never gotten this far
Ok, so the first piece of code is for when they are first registering, followed by the “fetch”, followed by the code underneath which substantiates them as a payee (and admins too I think I see). Does all of this code get pasted into the initial registry page? Or both registry page and login page? And is there a manual intervention I have to take to verify they paid?
The code I linked to in the other post is all handled in the serverless function. You can’t do this in the client-side code and if you try to do it, it’d be a huge security risk as anyone could do it for themselves.
Basically, this is how you’d go: signup (client-side) → pay (client-side) → update role using serverless function (server side).