Extra fields on signup
Hi, I know that current recommendation is to use custom UI for signup if any extra fields required. My problem with that approach is that addition of just one extra field requires us to code multiple custom different things:
- Signup form,
- Reset password (because it's usually part of signup form)
- Backend /signup method
- Validation using password rules specific by auth0 password policy (so that we don't get out of sync with login form)
And at the end we still have two different reset password forms which is really confusing for users. I propose to allow to add extra fields on signup form by using extension mechanism - fields are added by users of Auth0.lock not by Auth0 team. See example:
. showSignup({
extra_fields:
[
{ sel: 'input[name=fullname]', html: '<input name="fullname" type="text"></input>, field: "name" }
]
})
sel - selector to use to get value of the field html - the actual html used to render it. As it's just a string it's up to users use whatever they want - template, database base or just plain string like in example. field - the field to record information on user object. Then this line https://github.com/auth0/lock/blob/master/lib/mode-signup/index.js#L251 Needs to be changed to something like:
// set based on definition before
// extra_fields: [{name: 'Maxim Filimonov'}}
widget.$auth0.signup(xtend({
connection: connection.name,
username: (options._isUsernameRequired()) ? username : email,
email: email,
password: password,
auto_login: false,
popup: panel.options.popup,
}, extra_fields)
I believe, that way it won't be required to change auth.js as it already merges options with everything else.
Just wondering what are you thoughts on that before making PR
Ok just found a show stopper for this one. It looks like the auth.js is using dbconnections signup method instead of POST /users. Which i presume is done for security. However, the dbConnections signup method does not allow to pass any extra data when user signs up. Is it possible to change ?
Just asking: why don't use auth0.js just for signup and keep using lock for signin, reset password, and keep all the form's validations for those fields?
If the real issue is having to code a sign in form, reset form , and validations... it's not actually an issue as I see it.
As a feature request it would require quite more work than presented. It's still valid, but I don't recall extra_fields being parsed as is as you present.
@cristiandouce Cause auth.js doesn't allow us to signup with extra fields? :\ We are hacking its code now to make it use /users/create instead of dbconnections/signup as no one replied to us why this difference exists.
Maxim is asking for a feature request. I've also made this same feature request here: https://ask.auth0.com/t/customize-sign-up-page/666
A lot of people seems to be interested in this subject. It'll be a GREAT option to have within the default modal login/reg box.
any news whit this topic? i want to add just one extra field to the signup but i don't have any idea about how to do it
Perhaps file it at: http://feedback.auth0.com/
Hi, we are currently working on a new version of Lock that will allow you to add extra fields on the signup screen. Until it gets released you can code your own signup screen and use the Lock to sign in and reset password as @cristiandouce suggested. Thanks for the feedback and suggestions!
Any news?
@nemccarthy this is already supported OOTB https://auth0.com/docs/libraries/lock/v10/configuration#additionalsignupfields-array-