Phone Number validation

AI-generated summary

In a support thread titled ‘Phone Number validation,’ PBS seeks help validating user phone numbers during registration and triggering SMS OTP via custom JavaScript. They tried using the Custom Wizard plugin to auto-run after signup but struggled to access custom user fields (like ‘phone’) and execute theme JS code — noting that api.onPageChange doesn’t fire in wizards. pfaffman suggests a plugin may be needed, while codinghorror clarifies the goal: enforcing valid phone numbers at signup. nathank asks if PBS used the Custom Wizard plugin and seeks more details. Later, nathank follows up on a quoted post about displaying custom fields in wizards, asking for clarification on implementation. Meanwhile, Canapin raises trust concerns about an external site linked elsewhere, citing lack of company info, placeholder copyright, and auto-generated policies. Moin notes suspicious behavior: a user deleted their original post and reposted it with a link instead of answering questions. The thread reflects technical hurdles with Discourse’s wizard and JS integration, plus community caution around unverified external resources.

Hello Support,

I am trying to validate the phone number which user enters during registration. So I added few user fields to registration screen. So I make the user enter his phone number.
I also have added code in the themes JS section, which can send a OTP to user.

I have not been able to figure out the best way to take the phone number from profile and send an sms to it.
What I have tried:
Use a wizard after registration. It will run automatically.

  1. When it opens, I need the phone number of the profile. (I see that wizard can get default attributes like username u{username}, but not my custom field phonenumber u{phone})
  2. When I get the number (which I can make the user enter in a field again), how to call my JS code which I entered in the theme JS section.
    I have seen that when a normal page is loaded, api.onPageChange((url) => {
    This works. But when wizard gets loaded, this does not work.
    I tried using the document model,

if (‘Discourse’ in window) {
if (‘Discourse’ in window && typeof Discourse._registerPluginCode === ‘function’) {
Discourse._registerPluginCode
But register plugin fails.

So I am not sure, if I am on the right track or if there might be a simple way of taking the phone number and executing a custom JS code for sending sms.

Thanks,
Prashanth

I’m far from a maven on the Ember side, so perhaps you can do something there, but I doubt it. I think you’ll need a plugin.

Sorry, what is the goal here? To require a valid phone number at signup?

Did you do this with the Custom Wizard Plugin 🧙?

I’d love to hear more details.

How did you actually achieve that? I’m not sure I understand what you mean by “passed it through a custom field using the correct variable format”

The site you suggest seems not trustworthy at first glance.

Zero info on the company. Who operates it? In which country?
Auto-generated privacy policy. Non defined placeholders (© 0001 in the footer)…

Doesn’t inspire confidence at all.

They also posted, and when the question was asked, instead of answering, the first post was deleted and the same post, with a link, was reposted.