F
Filament9mo ago
NolanN

Display plain text token in modal after creation

I have a model which generates a Sanctum token after the model's created event fires. However, I want to show the plain text token to the user in a modal. Is there any way to do this currently?
6 Replies
awcodes
awcodes9mo ago
No. That would create a security issue. Just like a password, the hash can’t / shouldn’t be decoded. Only checked against.
NolanN
NolanNOP9mo ago
To clarify, I only want to do this at the moment is created, which is necessary for the user to actually use the token. I'll give them the ability to regenerate it but never see the plain text again. Regardless, what I'm really asking is if there is a way to execute an action and then put the output of that action in a modal rather than a notification
qilir
qilir9mo ago
Have you found a solution? Currently trying to figure out the same
toeknee
toeknee9mo ago
I would say to use a notification to send it providing you have it in an after state action or similar
Notification::make('api_key_notice')->title('Your API Key is')->body($apiKey)->send();
Notification::make('api_key_notice')->title('Your API Key is')->body($apiKey)->send();
NolanN
NolanNOP8mo ago
@qilir No I don't have a way to use a modal for this yet. @toeknee That is essentially what I've settled on for now. The main reason that I want to use a modal is to provide a little extra information which gets pretty long on a notification. I also generally think of notifications as helpful but ignorable information but relaying the token to the user is critical in my case
toeknee
toeknee8mo ago
So build a notification livewire component which shows a modal when data is pushed to it?
Want results from more Discord servers?
Add your server