How to delete users with Pow

Hi, I’m using Pow for Phoenix web app authentication, and out of the box there’s no way to delete a user. I see there’s a DELETE /registration endpoint created when I run mix phx.routes, but no UI to actually perform a DELETE. I can build it myself, I’m just wondering if anyone can tell me if I’m missing something. I find it weird that it’s not there - when the CRU functionality is but no D.


I don’t think there is, sorry!

My guess is that it’s that way because almost every app wants to handle that a little differently, and wiring it up yourself is exactly as easy or hard as your requirements.

For example, if you want to delete a user outright, all you need is a button/link, a route, and to call Users.delete_user(id). Not really worth building a UI in pow for that in my opinion, though maybe some docs would be helpful.

Or, in a lot of cases, you want to deactivate a user, but not delete their row to keep data integrity. Probably there are authorization considerations around who can delete or deactivate users. Those are all things that pow could do but it varies so much app by app that they probably didn’t think it was worth it out if the box. That’s a lot to maintain and would probably create a lot of support requests from people who want to change it a little to suit their needs. Probably the time was just better spent elsewhere. Although I bet they’d be willing to at least consider a pull request if you want to give it a go.


Yes that’s right. And one could easily follow the locked users guide to implement a feature for disabling users.

The guide on how to lock a user with Pow


Yeah, @carterbryden is correct, it’s just not in the default templates. It exists in the controller as I felt it important to have the CRUD. I guess a link could be added to the registration edit template, but I felt that leaving the decision to the dev made more sense.

I do see how this is a little confusing, the documentation should probably have a note on this.

And for anyone curious, this is what a delete link in the template would look like:

<%= link "Delete user", to: Routes.pow_registration_path(@conn, :delete), method: :delete, data: [confirm: "Are you sure?"]  %>
1 Like