Auto logging users in when they register

do you know how to redirect the user from UserCreation to his Dashboard directly within one step, without manually logging in?

Please explain a little more detailed what you need to achieve.

On the user registration or creation form you might be able to add a server connect security login step before the redirect.
You want to make the new user registration form into a login form too. Basically. So it is a dual purpose form.

Ok:

Normal way:

  1. UserCreateHisProfile (Email+Passw)
  2. UserLogin
  3. UserDashboard

My way:

  1. UserCreateHisProfile (Email+Passw)
  2. Redirect to — > UserDashboard

You want to auto-login the user, as soon as he creates an account?
Well, you can just add the login steps after the registration steps, and log your user in. Using the onsuccess event redirect them after that.

Yes this is very easy to implement, works and leaves client with mouth open. Did it for a project and they realised that even websites like Amazon don’t have this kind of functionality

3 Likes

Thanks Niko,
Maybe you can help @Freddy_Blockchain by showing him a quick example of the server action steps?

thanx to both of you! MouthOpenClients is what I want. I guess this Post helps others as well, as its a good comfort function!

A post was split to a new topic: Register New User and Auto Login on Success

I have added this to the official docs as suggested.

@t11 thats incredible! I‘ll try that solution later!

1 Like

Why you are using repeat ? Just one row return from your query .
Maybe it could be ;
Set variable for username and password then you can use it in if conditon

1 Like

Well since the repeat only executes once it is more or less the same as setting a variable. This is why Wappler is great, because you are actually programming and you can achieve the same result from different persepectives.

1 Like

Adding a repeat is an extra unneeded step actually.
and about your clients getting impressed so easy. i wish my client was like this :grinning:

and another point you still need to verify the email (like amazon do) before login the user. or you are opening the gate of spam and fake accounts to your application.

Thanks Niko, great tutorial, I would have done it almost exactly the same as you, although i also would have left out the repeat, not that i think it matters at all to be honest.

I agree, this is like any programming where even if you manually coded it you might do it different to the next person, both ways work, there will always be someone with a better way, or a different way, as long as it serves your purposes and works, then great.

I have also done systems like this before although they are normally only for internal administration where the users are a little more trusted, where I have used this for a more open market, the only thing i did a little different is push the data through Akismet, once Akismet returned all ok then i marked the user as trusted, I then sent an authentication email and gave the user 1 week to authenticate their email address, once authenticated I marked the account as confirmed.

I have to admit i still had many junk accounts created and to this day I still get at least one a week that try their luck. I do not think there is any real way around this though, just do what we can and know people will still do strange things regardless.

1 Like

great tutorial… this could be inserted in the Wappler docs

Welle they actually get impressed by the overall result. Actually they are impressed by the fact that everything asked is developed. Yes email verification is a good to have, but in this project autologin was more important than possible spam accounts.

Hi, new user here, so I apologise for digging up an old thread, but since it’s related I didn’t want to create a new one.
I currently have separate register and login server actions (which work fine independantly), but much like @Freddy_Blockchain, I’m attempting to auto-login the user upon sign-up/registration.

I’ve added a Server Connect element to the page, and set the Action to my login Server Action (No Auto Load selected). So in the success callback of the of the registration form (Success Dynamic Event), I added an action to load the Server Connect element, but obviously this fails in the browser as my Security Login step of the Login Server Action needs the username and password set (I’m guessing this is the issue).

How can I resolve this? Thanks in advance.

Hi Niall,
Please check the following guide:

Hi @Teodor, yes, I’ve seen this guide, but from what I can tell (I’m not familiar with Dreamweaver whatsoever), the registration and login steps are all bundled as one server action here.
I have them as separate server actions as I previously described, and so, when I call the Login Server Action from the Success Dynamic Event of the Register form, I’m not sure how to pass the required values to the Login Server Action (it currently gets them from $_POST.email and $_POST.password.sha512(…blah…).

Perhaps my issue might be that I’m not familiar with Dreamweaver at all, and so I’m not 100% sure how all of these steps translate to Wappler.

I hope that clarifies things a little?

Well if you need to do this kind of auto login, then it needs to be in the same server action :slight_smile: