rameshsharma
Dear All,
I have the below two urls in my project:-
Url1 - https://localhost:4443/register
Url2 - https://localhost:4443/register?scheme=tesco
If Url1 is used by a user while registration then we must verify the user with his email suffix (should have @tesco.com in the email address).
If Url2 is used then user is verified with his url query parameter (scheme=tesco) and then his email suffix can be anything (no restriction with email suffix)
I am struggling to make both the cases work together. Can someone please help me here. It would be of great help for me.
Trending in Questions
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
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
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’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
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
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #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)
benwilson512
Happy to help. The best place to start would be if we can see what you’ve tried so far, can you post your code? The more code the better!
rameshsharma
Thanks Ben for the reply.
Url2 requirement, I am able to achieve as I am verifying the scheme parameter in the url from the database and allowing user to proceed with any email suffix. Code snippet below:-
def partner_intro(%{request_path: path} = conn, %{“scheme” => scheme_value} = params, _guest)
Struggling to fit in the same module the url1 suffix validation condition.
rameshsharma
I have a module for email suffix validation like below where I have the email pattern mentioned.
But the problem is if I apply this ‘validate_email_domain’ module in my changeset, then it is applied for both Url1 and Url2. I do not want any email address restrictions for Url2 case. Only want the restriction for Url1 case.
def validate_email_domain(changeset, field, opts \ ) do
kokolegorille
Please note the site uses Markdown,
You should enclose code with ```
You struggle with the case where there is no scheme params?
Maybe add this after your first match?!
rameshsharma
Thanks, I can add another module as you mentioned.
But how to make the ‘validate_email_domain’ condition apply to one case and not to apply for another case.
Below is my one common changeset which has to be used for both the cases:-
rameshsharma
Is there any way to exclude the ‘validate_email_domain’ condition in one case and include in another case.
kokolegorille
If it is to separate case, I would not mind having separate changeset.
This is the descriptive way…
or add a parameter when domain needs to be checked, and use a condition.
rameshsharma
Can you please give some example of ‘add a parameter when domain needs to be checked, and use a condition’.
I am very new to elixir and phoenix web development.
rameshsharma
Any help here can you provide please
kokolegorille
You can differentiate case by pattern matching on param scheme (or not)… then I advise You to have to different changesets for each cases.
If You prefer, add a parameter when You call email_changeset… like should_verify_email and use a condition in the pipeline.
But I would try to avoid that, and use pattern match instead.