How to jump directly to the authentication page after successful registration of flask?

  1. now after registering to play, jump to the login screen, and then log in to authenticate. I feel redundant in this step. After successful registration, how can I jump directly to the authentication page and log in to the current registered user? This is equivalent to omitting login authentication after successful registration.
:

@auth.route("/login",methods=["GET","POST"])
def login():
    username = request.form.get("username")
    password = request.form.get("password")
    if username:
        user = User.query.filter_by(username=username).first()
        if user is not None and user.verify_passwd(password):
            login_user(user)
            return redirect(url_for("main.index"))
        else:
            error = "."
            return render_template("auth/login.html",error=error)
    return render_template("auth/login.html",success=success)

:

@auth.route("/register",methods=["GET","POST"])
def register():
    error = []
    if request.method == "POST":
        try:
            new_user = User(username=request.form.get("username"),email=request.form.get("email"),password=request.form.get("confirm_password"))
            db.session.add(new_user)
            db.session.commit()
        except:
            error.append(".")
            db.session.rollback()
        else:
            token = new_user.tokens()
            send_email(new_user.email, "Confirm Your Account","auth/email/confirm", user=new_user, token=token)
            global success
            success = ",."
            return  redirect(url_for("auth.login"))
    return render_template("auth/register.html",error=error)


:

@auth.route("/confirm/<token>")
@login_required
def confirm(token):
    if current_user.status:
        return redirect(url_for("main.index"))
    if current_user.loosen_tokens(token):
        db.session.commit()
        return redirect(url_for("main.index"))
Mar.10,2021

maybe you want to finish login's work after register succeeds:
that is, put

in register () .
        else:
            token = new_user.tokens()
            send_email(new_user.email, 'Confirm Your Account','auth/email/confirm', user=new_user, token=token)
            global success
            success = ',.'
            -sharp 
            login_user(new_user)
            return redirect(url_for('main.index'))

but the problem is that your register will enter a mail authentication session after success. If the user does not pass the mail authentication, then the user cannot log in. The original code return redirect (url_for ('auth.login')) redirects the page to the landing page. It is to give the user time to authenticate the email, and log in again after the email authentication is finished. So this link is essential, unless you let the front end keep polling with js until you are sure that you have passed the email authentication and then automatically jump to main.index .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e3f7-19bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e3f7-19bd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?