Giter VIP home page Giter VIP logo

Comments (8)

polterguy avatar polterguy commented on June 12, 2024 1

I am able to reproduce it. We'll probably have a solution to you fast, hopefully by the end of the day :)

from magic.

polterguy avatar polterguy commented on June 12, 2024 1

The problem is that even though you can use an email as username(s), the system doesn't enforce this, to allow for having usernames being "public handles", for social media sites etc, where the username is publicly displayed, but the email is not publicly displayed. Hence, we need to separate the username and the email address. To provide an email to the system during registrations, you'll have to slightly modify your payload to the following.

{
    "username": "[email protected]",
    "password": "ThisIsAPassword@123",
    "frontendUrl": "https://demo.com/verify",
    "subject": "Welcome",
    "extra": {
      "name": "Test User",
      "email": "[email protected]"
    }
}

Notice - The added email extra field ...

The above of course allows you to use a different value as usernames if you wish - But this is optional. If you want to enforce usernames being the same as email address, you're of course free to do this as you see fit in your own (frontend/middleware) logic ...

Out of curiosity, I assume you found the recipe of how to implement user registrations "somewhere" out there? Do you have a link to it? Such that we can edit its wording? The ability to separate usernames and email addresses is a fairly new addition to the core, and hence there might be documentation out there that doesn't reflect this behaviour ...

Please close the issue if this fixes it for you :)

from magic.

polterguy avatar polterguy commented on June 12, 2024

Give me some time and I'll come back to you on this one. What version of Magic are you using?

from magic.

AlkenD avatar AlkenD commented on June 12, 2024

The problem is that even though you can use an email as username(s), the system doesn't enforce this, to allow for having usernames being "public handles", for social media sites etc, where the username is publicly displayed, but the email is not publicly displayed. Hence, we need to separate the username and the email address. To provide an email to the system during registrations, you'll have to slightly modify your payload to the following.

{
    "username": "[email protected]",
    "password": "ThisIsAPassword@123",
    "frontendUrl": "https://demo.com/verify",
    "subject": "Welcome",
    "extra": {
      "name": "Test User",
      "email": "[email protected]"
    }
}

Notice - The added email extra field ...

The above of course allows you to use a different value as usernames if you wish - But this is optional. If you want to enforce usernames being the same as email address, you're of course free to do this as you see fit in your own (frontend/middleware) logic ...

Out of curiosity, I assume you found the recipe of how to implement user registrations "somewhere" out there? Do you have a link to it? Such that we can edit its wording? The ability to separate usernames and email addresses is a fairly new addition to the core, and hence there might be documentation out there that doesn't reflect this behaviour ...

Please close the issue if this fixes it for you :)

https://docs.aista.com/tutorials/registering/

here is the link to the tutorial which i referred.

--
btw an offtopic question so i just tried registering a user using a basic react frontend but for some reason i'm facing CORS issue even though the docs stage that if no url is assigned in the magic config it defaults to allow all.

from magic.

polterguy avatar polterguy commented on June 12, 2024

just tried registering a user using a basic react frontend but for some reason i'm facing CORS

Ouch! It shouldn't have any CORS issues - But you can override the CORS accepted frontends in its frontends declaration in the "Config" menu item ...

here is the link to the tutorial which i referred

Thank you, we'll edit it in accordance to how it actually is ... :)

from magic.

AlkenD avatar AlkenD commented on June 12, 2024

the problem still persists should i open a new issue ?

from magic.

polterguy avatar polterguy commented on June 12, 2024

the problem still persists should i open a new issue

Yes please, it makes things easier to track on a per issue basis ...

I'll close this guy ...

from magic.

polterguy avatar polterguy commented on June 12, 2024

I have updated the relevant documentation now - Thank you :)

from magic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.