How can I pass login form within my register_user.html? I am trying to create both login/register at same page. I tried passing in login_user_form, it didn't work and it makes perfect sense as to why it wouldn't work. Does flask-security provide us a way to pass in default forms we want rather than extendedForm which gets inherited from RegisterForm...? Or to have both of these functionality on same page; I'd have to consider other options.
This was my attempt:
class ExtendedConfirmRegisterForm(RegisterForm):
first_name = StringField('First Name')
last_name = StringField('Last Name')
type_s = StringField()
club_access_type = StringField()
monthly_plan = StringField()
start_time = StringField()
end_time = StringField()
where = StringField()
subscription_type=StringField()
booking_id = StringField()
remember = LoginForm.remember
login_submit = LoginForm.submit
login_email = LoginForm.email
login_password = LoginForm.password
login_next = LoginForm.next
I then tried passing this into jinja (security/register_user.html) like this.
{{ register_user_form.hidden_tag() }}{{ render_field(register_user_form.login_email, style="width:120%; padding-bottom:0.10%; margin-left:-150%; border-top-color: black;background: rgba(130,130,130,.3); border-left-color: black;border-bottom-color: black;border-right-color:black") }}This is for email; and it doesn't work; but if I were to change login_email to simply email it works....
Forget me if I misunderstood your question. I think you can set SECURITY_LOGIN_WITHOUT_CONFIRMATION=True to automatically login a user after registration. Additionally you can still ask user to confirm his registration via email for next login with SECURITY_CONFIRMABLE=True.
Hey no. That's not what I am asking. Basically I am trying to have both login and register in same page. So I wanted to use login form within register form. So I can have seperate email pass fields for each login and registering.
Then I would recommend to create your own view and template.
So there is no way for me to use multiple forms within register view in flask-security? Or so login form within register view?
Figured out. Found a way to pass in; peeked inside the repository and realized; you could pass default argument in register view through
@security.register_context_processor
def security_context_processor():
return dict(login_user_form=LoginForm())
That let me call login_user_form within register user template!
Most helpful comment
Figured out. Found a way to pass in; peeked inside the repository and realized; you could pass default argument in register view through
That let me call
login_user_formwithin register user template!