Answer the question
In order to leave comments, you need to log in
How to login a newly registered user?
Hey!
I use koa , koa-generic-session , koa-passport , passport-local .
The user enters the registration form, enters data, submits. The node registers the user in the database (login, password hash, salt, ...). Further throws on the login form.
How to make sure that after registering a user in the database, he does not need to go to the login form and register his session, but so that the user session is immediately registered when the user is saved to the database?
update: You can, of course, take a koa-request and send the completed login form to yourself, but surely you can do it without crutches?
Answer the question
In order to leave comments, you need to log in
As usual, everything is simple:
const passport = require('koa-passport');
...
yield passport.authenticate('local', {
successRedirect: '/',
failureRedirect: '/'
});
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question