NullOranje
I’m working on an application that uses Pow for user authentication. One of the features I need to implement is to invite users, but this is done by a non-interactive process. Users will still verify themselves via the same process. I’m a bit lost in the documentation, but from what I see, I can use PowInvitation.Ecto.Context to create a new user changeset, but the logic of inserting that into the database and sending the invitation would be left for me to implement.
Two questions:
- Is this a case where it makes more sense to write the entire Invitation process myself?
- If I do write the backend, how do I prevent the Phoenix router from exposing the [:new, :create, :show] routes? My understanding is that these would be automagically exposed via pow_extension_routes()
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Latest Phoenix Threads
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
danschultzer
You can exclude
PowInvitationin thePow.Extension.Phoenix.Routermacro opts and add in the routes manually:To create the invited user:
To send out the invitation email you need this:
PowInvitationexpects aninvited_byassoc which is the user that initiated the invitation. You can make a custominvite_changeset/3to ignore it.NullOranje
That’s exactly what I was looking to do.. Thanks @danschultzer!
NullOranje
I guess I’m still stuck on the concept. All the calls for
PowInvitationrequire aPlug.Connto carry variables through. My use case does not use aConn, so I feel like I’m trying to reimplement all the methods to get this to work. Am I making this harder than it needs to be?Update: Maybe I’ve got my solution?
ConfigConnand use `Pow.Plug.put_config(conn, config) to storedanschultzer
Yeah, this is the easiest. It’s also how you deal with absinthe where you don’t have access to
conn: Use Pow.PasswordReset.Plug.create_reset_token without a conn · Issue #61 · pow-auth/pow · GitHubIt’s kinda awkward, but due to how the Phoenix modules all work with
conntransformation even if some methods ultimately just fetches the Pow config.NullOranje
At least I’m not crazy. It still feels a bit wrong, but it does work well, so I guess that’s what matters. Thanks!
NullOranje
One last question:
I’ve customized the user registration template for Pow, but PowInvitaiton wants to use it’s own. I’d like to use the same template for both. I’m still new to Phoenix, so I’m having a hard time figuring out how to have the PowInvitation controller use my custom view/template.
danschultzer
If you’ve set the
:web_modulein the Pow config, then the extensions will also use custom templates. The PowInvitation templates are generated withmix pow.extension.phoenix.gen.templates --extension PowInvitation, and you should have seen an error if they where not generated visiting the invitation endpoints. The templates will be intemplates/pow_invitation.NullOranje
RIght, but it’s a separate template for PowInvitation. I’d rather not duplicate myself with two sets of templates for users to set their passwords. Is it possible for the modules to share the same username/password template?
danschultzer
Set up a partial template in Phoenix, and use that in both:
MyNameIsURL
Hey Dan,
I followed your steps to create a custom invite and called
PowInvitation.Ecto.Context.create(invited_by, params, config)like you suggested, then passed the user to thedeliver_emailfunction like you suggested. Butuser.invitation_tokenis the unsigned UUID. So the emails were going out with a link like/invitations/b2a4a605-29e3-41a3-b114-89231db3da0e/edit.So I modified your
deliver_emailfunction you posted like so. Is calling ThePowInvitation.Plug.sign_invitationfunction the best way to generate the signed token for the email. Or is there a higher level function I should be calling to sign the token and generate the user at the same time. Here is my solution below: