Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Users #88

Open
markgalup opened this issue May 22, 2015 · 3 comments
Open

Handling Users #88

markgalup opened this issue May 22, 2015 · 3 comments

Comments

@markgalup
Copy link

Hi Robert,

Thank you very much for your excellent book. My apologies in advance if this is an obvious answer as I am somewhat new to flask. In this chapter, it seems you describe several account creation methods - "create_account" and "signup" to be specific - which don't appear to work together. Also, you only describe a User model once, and it only contains columns for 'username' and '_password', whereas earlier you mention creating an instance of the User class with 'email' and 'password', as well as an 'email_confirmed' boolean. I am confused as to if this chapter is meant to have any coherence throughout the code samples or if I am missing the logic. I see most of the snippets building off of eachother and then some not at all.

Thanks for your thoughts in advance,
Mark

@martinbel
Copy link

martinbel commented Jun 11, 2016

I think in views.py you can add the email_confirmed = False value.

...
def create_account():
    form = EmailPasswordForm()
    if form.validate_on_submit():
        user = User(
            email = form.email.data,
            email_confirmed = False,
            password = form.password.data
        )

        db.session.add(user)
        db.session.commit()

Then def confirm_email(token): should be just an update where this is changed to False. Would this be enough @rpicard?

@rpicard
Copy link
Owner

rpicard commented Jun 13, 2016

@markgalup The chapter isn't meant to have coherence through the code samples. Each is just meant to illustrate a specific point.

@rpicard
Copy link
Owner

rpicard commented Jun 13, 2016

@martinbel I think it's easier to specify the default value of False for the email_confirmed column in the database model, but however it gets set works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants