Bedtimestory9
An admin will review all the info from a user’s register info and decide if the user will pass the approval or not. When new users submit their registration form, their info will send to our admin to have it approve. And only after approval could the new user be created.
So … How should I create such an admin system?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Hey @Bedtimestory9 your post has been moved to the moderation queue because there isn’t really enough information for someone to help you here. How much Elixir do you know? What sort of system is this? What have you tried so far, and where did you get stuck?
Bedtimestory9
Hi @benwilson512 sorry for the ambiguity, I’ll try my best to clarify.
My knowledge on Phoenix is as much as the first chapter on Phoenix Framework by Pragmatic studio
This is my registration process:
So so far as long as the user fill out their email with an
@symbol as well as complying with password length rule, the user will be inserted into the Repo.And I want to have it differently, I want to have an admin(or me) to go through a review of their input, once I click approve, then will it be created.
If this is still too vague, can you point me to what topics should I explore? I am pretty much in the fog too. But I’m sure there’re websites like this. For example, you submit a registration form to create an account on a website, and the website responded with “Thank you for your submission, your account will need to be approved, which might take a few days.” Or something like that.
Yeah I think my question contains too many topics, if you can give me some pointer to what should I read I’ll greatly appreciate it.
kokolegorille
One solution is to have a status field on the User. For example approved, not_approved. Then You can ensure only approved user have access ?!
The admin just need to toggle this field to allow user access
sodapopcan
Pretty much what the gorilla said.
A great resource to read is the output of
mix phx.gen.auth. While it doesn’t provide this functionality out of the box, it’s really easy to tack on and the rest of the code is great study for how to properly implement authn.Of course there are different ways to implement this with different trade offs but this probably what I would do. Firstly, for something like approval I prefer a dedicated field—
approved_atas a timestamp—over a status so that what I’m going to use, but YMMV.Assuming you’ve gen’d your auth with:
Create a migration to add
approved_attimestamp field to your users table, add thefieldto yourUserSchema (make sure it defaults tonilwhich means doing nothing).In
MyAppWeb.UserAuthlook fordef on_mount(:ensure_authenticated, .... This is where you will want to check if the user has been approved and deal with accordingly. You can change it to look something like this:As far as notifying admins and making screens to manage the requests, I’ll leave that part up to you. It’s a simple LiveView although if you want Email notifications that is a whole other thing.
Bedtimestory9
This answers my question. Though the book didn’t use liveview from the start, I’m glad to know the implementation logic is almost the same on my Auth.ex.
I’m having a little trouble to add a timestamp to the
approved_atfield atm, as well as the nil type which is not recognized by phoenix but I’ll crunch through some more docs to get at it. Thanks for the improvement!