[Flask] Unable to set current_user.authenticated to True

Gergely Polonkai gergely at polonkai.eu
Tue Jul 9 02:55:20 EDT 2019


I usually go with this snippet instead:

{% if current_user.is_authenticated %}
Login button
{% else %}
Logged in as {{ current_user}} Logout button
{% endif %}

Depending on your logic, a logged in user may not have an id property, or
the anonymous user can have an id. is_authenticated is consistently
available.

Best,
Gergely


On Mon, 8 Jul 2019, 19:01 Scott Woodstock, <sidwoodstock at gmail.com> wrote:

> Because of what Gergely said, I went ahead and tested my suggestion to you
> since began doubting it would work. He is right, when not signed in
> Flask-Login returns an AnonymousUser rather than None. I was able to get my
> concept working by changing it as below, however, since Anonymous users do
> not have ID's.
>
>     {% if current_user.id %}
>       <div>Signout</div>
>     {% else %}
>       <div>Sign In</div>
>     {% endif %}
>
> -Scott Woodstock
>
> On Mon, Jul 8, 2019 at 7:14 AM <flask-request at python.org> wrote:
>
>> Send Flask mailing list submissions to
>>         flask at python.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         https://mail.python.org/mailman/listinfo/flask
>> or, via email, send a message with subject or body 'help' to
>>         flask-request at python.org
>>
>> You can reach the person managing the list at
>>         flask-owner at python.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Flask digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re: Unable to set current_user.authenticated to True
>>       (Abdul Mohammed)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 8 Jul 2019 15:14:18 +0100
>> From: Abdul Mohammed <imonikemohammed at gmail.com>
>> To: flask at python.org
>> Subject: Re: [Flask] Unable to set current_user.authenticated to True
>> Message-ID:
>>         <CAEKkz878g_THx0szR7e=2vcJsLFhLiXy9REu3=TiMSUp=
>> VuETw at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Many thanks Scott. Will try thia and let you know how it goes.
>>
>> On Thu, Jul 4, 2019 at 7:52 PM <flask-request at python.org> wrote:
>>
>> > Send Flask mailing list submissions to
>> >         flask at python.org
>> >
>> > To subscribe or unsubscribe via the World Wide Web, visit
>> >         https://mail.python.org/mailman/listinfo/flask
>> > or, via email, send a message with subject or body 'help' to
>> >         flask-request at python.org
>> >
>> > You can reach the person managing the list at
>> >         flask-owner at python.org
>> >
>> > When replying, please edit your Subject line so it is more specific
>> > than "Re: Contents of Flask digest..."
>> >
>> >
>> > Today's Topics:
>> >
>> >    1. Re: Unable to set current_user.authenticated to True
>> >       (sidwoodstock .)
>> >
>> >
>> > ----------------------------------------------------------------------
>> >
>> > Message: 1
>> > Date: Thu, 4 Jul 2019 11:50:45 -0700
>> > From: "sidwoodstock ." <sidwoodstock at gmail.com>
>> > To: flask at python.org
>> > Subject: Re: [Flask] Unable to set current_user.authenticated to True
>> > Message-ID:
>> >         <
>> > CALovGGOJSH0M8YkYkkfYV9AsyMOut_3SmR-OfPSYvrpqrLdtbQ at mail.gmail.com>
>> > Content-Type: text/plain; charset="utf-8"
>> >
>> > Ahh okay I understand now.
>> >
>> > I haven't tested this myself, but perhaps try {% if current_user %} as
>> your
>> > conditional since it ought to return None if no one is logged in.
>> >
>> > -Scott
>> >
>> > On Thu, Jul 4, 2019 at 8:56 AM <flask-request at python.org> wrote:
>> >
>> > > Send Flask mailing list submissions to
>> > >         flask at python.org
>> > >
>> > > To subscribe or unsubscribe via the World Wide Web, visit
>> > >         https://mail.python.org/mailman/listinfo/flask
>> > > or, via email, send a message with subject or body 'help' to
>> > >         flask-request at python.org
>> > >
>> > > You can reach the person managing the list at
>> > >         flask-owner at python.org
>> > >
>> > > When replying, please edit your Subject line so it is more specific
>> > > than "Re: Contents of Flask digest..."
>> > >
>> > >
>> > > Today's Topics:
>> > >
>> > >    1. Re: Flask Digest, Vol 49, Issue 5 (Abdul Mohammed)
>> > >    2. Re: Flask Digest, Vol 49, Issue 6 (Abdul Mohammed)
>> > >
>> > >
>> > > ----------------------------------------------------------------------
>> > >
>> > > Message: 1
>> > > Date: Thu, 4 Jul 2019 16:22:42 +0100
>> > > From: Abdul Mohammed <imonikemohammed at gmail.com>
>> > > To: flask at python.org
>> > > Subject: Re: [Flask] Flask Digest, Vol 49, Issue 5
>> > > Message-ID:
>> > >         <
>> > > CAEKkz85XoPnseQ9_jF_0WcfKDruXLAKKCBp4+2k_FogNA8zVcQ at mail.gmail.com>
>> > > Content-Type: text/plain; charset="utf-8"
>> > >
>> > > Thanks Gergely for the response.
>> > > Yes I am using Flask-Login and I think directly because this is how I
>> > > import it:
>> > >
>> > > from flask_login import login_user
>> > >
>> > > My problem is not that I can't log in. I can log in fine. The problem
>> is
>> > > essentially that I can not log out. I am trying to use the value of
>> > > current_user.is_authenticated to determine whether to show the "Sign
>> in"
>> > or
>> > > "Sign out" link. If True, it shows "Sign out" and "Sign in" when
>> False.
>> > > For some reason, the value remains False after I have logged in so the
>> > > "Sign out" link never displays and so I am trapped in the app (Please
>> > save
>> > > me!!!)
>> > > because I can't log out. I hope I have made my problems clearer.
>> > >
>> > > Regards
>> > >
>> > > On Wed, Jul 3, 2019 at 5:04 PM <flask-request at python.org> wrote:
>> > >
>> > > > Send Flask mailing list submissions to
>> > > >         flask at python.org
>> > > >
>> > > > To subscribe or unsubscribe via the World Wide Web, visit
>> > > >         https://mail.python.org/mailman/listinfo/flask
>> > > > or, via email, send a message with subject or body 'help' to
>> > > >         flask-request at python.org
>> > > >
>> > > > You can reach the person managing the list at
>> > > >         flask-owner at python.org
>> > > >
>> > > > When replying, please edit your Subject line so it is more specific
>> > > > than "Re: Contents of Flask digest..."
>> > > >
>> > > >
>> > > > Today's Topics:
>> > > >
>> > > >    1. Re: Unable to set current_user.authenticated to True
>> > > >       (Gergely Polonkai)
>> > > >
>> > > >
>> > > >
>> ----------------------------------------------------------------------
>> > > >
>> > > > Message: 1
>> > > > Date: Tue, 2 Jul 2019 19:01:20 +0200
>> > > > From: Gergely Polonkai <gergely at polonkai.eu>
>> > > > To: Leni Kadali Mutungi <lenikmutungi at gmail.com>
>> > > > Cc: flask <Flask at python.org>
>> > > > Subject: Re: [Flask] Unable to set current_user.authenticated to
>> True
>> > > > Message-ID:
>> > > >         <CACczBUJWEAoLjnsQSh5Z+3mVuzjZ1=Ly-=
>> > > > zxtk3bMO+n-+-y3Q at mail.gmail.com>
>> > > > Content-Type: text/plain; charset="utf-8"
>> > > >
>> > > > Hello,
>> > > >
>> > > > I assume you are using Flask-Login (either directly or via another
>> > > > extension like Flask-Security). If this is the case, you can import
>> > > > login_user and call it like login_user(user).
>> > > >
>> > > > If that does not work, you may want to check if the user is active
>> (ie.
>> > > not
>> > > > disabled), as it is the most common culprit when a user can?t be
>> logged
>> > > in.
>> > > >
>> > > > Best,
>> > > > Gergely
>> > > >
>> > > > On Mon, 1 Jul 2019, 19:03 Leni Kadali Mutungi, <
>> lenikmutungi at gmail.com
>> > >
>> > > > wrote:
>> > > >
>> > > > > I think you mean to set it as `current_user.is_authenticated =
>> True`.
>> > > > >
>> > > > > On 7/1/19 6:14 PM, Abdul Mohammed wrote:
>> > > > > > Hello everyone,
>> > > > > >                   I am trying to toggle between "Sign in" and
>> "Sign
>> > > > > > out" links using the current_user.is_authenticated variable such
>> > that
>> > > > > > when it returns False, the "Sign in" is displayed and when True
>> the
>> > > > > > "Sign out" link is displayed. At some point in the login code I
>> set
>> > > > > > current_user.authenticated = True. The thing is that by the I am
>> > > > > > successfully logged in and presented with the next view, it is
>> the
>> > > > > > "Sign in" link that is still displayed. When I check
>> > > > > > current_user.is_authenticated, it returns False, even though I
>> had
>> > > > > > explicitly set it to True. Please can anyone point out what I am
>> > > might
>> > > > > > be doing wrong? Here is my code:
>> > > > > >
>> > > > > > I have a base.html file that contains the "Sign in" and "Sign
>> out"
>> > > > > > links that is extended by the other templates:
>> > > > > >
>> > > > > > <ul class="nav navbar-nav navbar-right">
>> > > > > >    {% if (current_user.is_authenticated) %}
>> > > > > >    <li><a href="{{ url_for('logout') }}">Sign Out</a></li>
>> > > > > >    {% else %}
>> > > > > >    <li><a href="{{ url_for('index') }}">Sign In</a></li>
>> > > > > >    {% endif %}
>> > > > > > </ul>
>> > > > > >
>> > > > > > <body>
>> > > > > > {% block page_content %}{% endblock %}
>> > > > > > </body>
>> > > > > >
>> > > > > >
>> > > > > >  When the app first loads in the browser it displays a login
>> form,
>> > > > > > login.html:
>> > > > > >
>> > > > > >  {% extends "base.html" %}
>> > > > > >
>> > > > > > {% block content %}
>> > > > > >     {% import "bootstrap/wtf.html" as wtf %}
>> > > > > >     {% block title %}Flasky - Login{% endblock %}
>> > > > > >     {% block page_content %}
>> > > > > >     <div class="page-header">
>> > > > > >         <h1>Login</h1>
>> > > > > >     </div>
>> > > > > >     <div class="col-md-4">
>> > > > > >         {{ wtf.quick_form(form) }}
>> > > > > >     </div>
>> > > > > >     {% endblock %}
>> > > > > > {% endblock %}
>> > > > > >
>> > > > > > When a user logs in, it loads a template dashboard.html that
>> > displays
>> > > > > > a map. The top part looks like this:
>> > > > > >
>> > > > > > {% extends "base.html" %}
>> > > > > >
>> > > > > > {% block page_content %}
>> > > > > > <html>
>> > > > > >  <head>
>> > > > > >    <title>Lagos Map</title>
>> > > > > >    <link rel="stylesheet"
>> > > > > > href="https://unpkg.com/leaflet@1.1.0/dist/leaflet.css"
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> integrity="sha512-wcw6ts8Anuw10Mzh9Ytw4pylW8+NAD4ch3lqm9lzAsTxg0GFeJgoAtxuCLREZSC5lUXdVyo/7yfsqFjQ4S+aKw=="
>> > > > > >    crossorigin=""/>
>> > > > > >    <script src="https://unpkg.com/leaflet@1.1.0/dist/leaflet.js
>> "
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> integrity="sha512-mNqn2Wg7tSToJhvHcqfzLMU6J4mkOImSPTxVZAdo+lcPlk+GhZmYgACEe0x35K7YzW1zJ7XyJV/TT1MrdXvMcA=="
>> > > > > >    crossorigin=""></script>
>> > > > > >    <script
>> > > > > > src="
>> > > > >
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.js
>> > > > > "></script>
>> > > > > >    <link rel="stylesheet"
>> > > > > > href="
>> > > > >
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css
>> > > > "
>> > > > >
>> > > > > > />
>> > > > > >    <link rel="stylesheet"
>> > > > > > href="
>> > > > >
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.css
>> > > > "
>> > > > >
>> > > > > > />
>> > > > > >    <script
>> > > > > > src="
>> > > > >
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.js
>> > > > > "></script>
>> > > > > >    <script
>> > > > > > src="
>> https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js
>> > > > > "></script>
>> > > > > >   ...
>> > > > > >   ...
>> > > > > >
>> > > > > > And these are the relevant routes:
>> > > > > >
>> > > > > > @app.route('/',methods=['GET','POST'])
>> > > > > > def index():
>> > > > > >       form = LoginForm()
>> > > > > >       if form.validate_on_submit():
>> > > > > >           user =
>> > User.query.filter_by(email=form.email.data).first()
>> > > > > >           if user is not None and
>> > > > > user.check_password(form.password.data):
>> > > > > >               user.authenticated = True
>> > > > > >               current_user = user
>> > > > > >               db.session.add(current_user)
>> > > > > >               db.session.commit()
>> > > > > >               login_user(current_user, form.remember_me.data)
>> > > > > >               return redirect(request.args.get('next') or
>> > > > > > url_for('dashboard'))
>> > > > > >           flash('Invalid username or password.')
>> > > > > >        return render_template('auth/login.html', form=form)
>> > > > > >
>> > > > > > @app.route('/dashboard')
>> > > > > > def dashboard():
>> > > > > >       return render_template("dashboard.html")
>> > > > > >
>> > > > > > Thank you for your time.
>> > > > > >
>> > > > > > _______________________________________________
>> > > > > > Flask mailing list
>> > > > > > Flask at python.org
>> > > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > >
>> > > > > --
>> > > > > -- Kind regards,
>> > > > > Leni Kadali Mutungi
>> > > > >
>> > > > > _______________________________________________
>> > > > > Flask mailing list
>> > > > > Flask at python.org
>> > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > >
>> > > > -------------- next part --------------
>> > > > An HTML attachment was scrubbed...
>> > > > URL: <
>> > > >
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190702/424f55cc/attachment-0001.html
>> > > > >
>> > > >
>> > > > ------------------------------
>> > > >
>> > > > Subject: Digest Footer
>> > > >
>> > > > _______________________________________________
>> > > > Flask mailing list
>> > > > Flask at python.org
>> > > > https://mail.python.org/mailman/listinfo/flask
>> > > >
>> > > >
>> > > > ------------------------------
>> > > >
>> > > > End of Flask Digest, Vol 49, Issue 5
>> > > > ************************************
>> > > >
>> > > -------------- next part --------------
>> > > An HTML attachment was scrubbed...
>> > > URL: <
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190704/29797e8e/attachment-0001.html
>> > > >
>> > >
>> > > ------------------------------
>> > >
>> > > Message: 2
>> > > Date: Thu, 4 Jul 2019 16:55:18 +0100
>> > > From: Abdul Mohammed <imonikemohammed at gmail.com>
>> > > To: flask at python.org
>> > > Subject: Re: [Flask] Flask Digest, Vol 49, Issue 6
>> > > Message-ID:
>> > >         <CAEKkz86CgWtkHuahmd9KDyWVbEOfvGs3qdk31O8youK8qQnO=
>> > > g at mail.gmail.com>
>> > > Content-Type: text/plain; charset="utf-8"
>> > >
>> > > Thanks Scott.
>> > > I just explained to Gergely that my problem is not logging in but
>> getting
>> > > the value of current_user.is_authenticated to change to True so that I
>> > > can log out. I wasn't originally doing the current_user = user
>> > assignment.
>> > > I could log in with either current_user or user. When the value of
>> > > current_user.is_authenticated wouldn't change to True, I added it
>> > because i
>> > > was just trying to see whether it would solve my problem. I will get
>> rid
>> > of
>> > > it
>> > > but the problem is likely to remain.
>> > >
>> > > On Thu, Jul 4, 2019 at 5:26 AM <flask-request at python.org> wrote:
>> > >
>> > > > Send Flask mailing list submissions to
>> > > >         flask at python.org
>> > > >
>> > > > To subscribe or unsubscribe via the World Wide Web, visit
>> > > >         https://mail.python.org/mailman/listinfo/flask
>> > > > or, via email, send a message with subject or body 'help' to
>> > > >         flask-request at python.org
>> > > >
>> > > > You can reach the person managing the list at
>> > > >         flask-owner at python.org
>> > > >
>> > > > When replying, please edit your Subject line so it is more specific
>> > > > than "Re: Contents of Flask digest..."
>> > > >
>> > > >
>> > > > Today's Topics:
>> > > >
>> > > >    1. Re: Unable to set current_user.authenticated to True
>> > > >       (sidwoodstock .)
>> > > >    2. Re: Unable to set current_user.authenticated to True
>> > > >       (Gergely Polonkai)
>> > > >
>> > > >
>> > > >
>> ----------------------------------------------------------------------
>> > > >
>> > > > Message: 1
>> > > > Date: Wed, 3 Jul 2019 09:19:20 -0700
>> > > > From: "sidwoodstock ." <sidwoodstock at gmail.com>
>> > > > To: flask at python.org
>> > > > Subject: Re: [Flask] Unable to set current_user.authenticated to
>> True
>> > > > Message-ID:
>> > > >         <CALovGGPpEBH==M0jK7S4g2aH4v0oBp=Lnx--=
>> > > > KV78LHGK2k8hA at mail.gmail.com>
>> > > > Content-Type: text/plain; charset="utf-8"
>> > > >
>> > > > Also, if Gergely's suggestion doesn't work, you could try removing
>> your
>> > > > variable assignment of current_user = user. I see no practical
>> reason
>> > to
>> > > do
>> > > > this, and since current_user is a built-in (and very handy)
>> variable,
>> > > maybe
>> > > > that is somehow related to your issue?
>> > > >
>> > > > > > current_user = user
>> > > >
>> > > > and then just call login_user directly with your user you already
>> have
>> > at
>> > > > hand:
>> > > >
>> > > > > >               login_user(user, form.remember_me.data)
>> > > >
>> > > > -Scott
>> > > >
>> > > > On Wed, Jul 3, 2019 at 9:03 AM <flask-request at python.org> wrote:
>> > > >
>> > > > > Send Flask mailing list submissions to
>> > > > >         flask at python.org
>> > > > >
>> > > > > To subscribe or unsubscribe via the World Wide Web, visit
>> > > > >         https://mail.python.org/mailman/listinfo/flask
>> > > > > or, via email, send a message with subject or body 'help' to
>> > > > >         flask-request at python.org
>> > > > >
>> > > > > You can reach the person managing the list at
>> > > > >         flask-owner at python.org
>> > > > >
>> > > > > When replying, please edit your Subject line so it is more
>> specific
>> > > > > than "Re: Contents of Flask digest..."
>> > > > >
>> > > > >
>> > > > > Today's Topics:
>> > > > >
>> > > > >    1. Re: Unable to set current_user.authenticated to True
>> > > > >       (Gergely Polonkai)
>> > > > >
>> > > > >
>> > > > >
>> > ----------------------------------------------------------------------
>> > > > >
>> > > > > Message: 1
>> > > > > Date: Tue, 2 Jul 2019 19:01:20 +0200
>> > > > > From: Gergely Polonkai <gergely at polonkai.eu>
>> > > > > To: Leni Kadali Mutungi <lenikmutungi at gmail.com>
>> > > > > Cc: flask <Flask at python.org>
>> > > > > Subject: Re: [Flask] Unable to set current_user.authenticated to
>> True
>> > > > > Message-ID:
>> > > > >         <CACczBUJWEAoLjnsQSh5Z+3mVuzjZ1=Ly-=
>> > > > > zxtk3bMO+n-+-y3Q at mail.gmail.com>
>> > > > > Content-Type: text/plain; charset="utf-8"
>> > > > >
>> > > > > Hello,
>> > > > >
>> > > > > I assume you are using Flask-Login (either directly or via another
>> > > > > extension like Flask-Security). If this is the case, you can
>> import
>> > > > > login_user and call it like login_user(user).
>> > > > >
>> > > > > If that does not work, you may want to check if the user is active
>> > (ie.
>> > > > not
>> > > > > disabled), as it is the most common culprit when a user can?t be
>> > logged
>> > > > in.
>> > > > >
>> > > > > Best,
>> > > > > Gergely
>> > > > >
>> > > > > On Mon, 1 Jul 2019, 19:03 Leni Kadali Mutungi, <
>> > lenikmutungi at gmail.com
>> > > >
>> > > > > wrote:
>> > > > >
>> > > > > > I think you mean to set it as `current_user.is_authenticated =
>> > True`.
>> > > > > >
>> > > > > > On 7/1/19 6:14 PM, Abdul Mohammed wrote:
>> > > > > > > Hello everyone,
>> > > > > > >                   I am trying to toggle between "Sign in" and
>> > "Sign
>> > > > > > > out" links using the current_user.is_authenticated variable
>> such
>> > > that
>> > > > > > > when it returns False, the "Sign in" is displayed and when
>> True
>> > the
>> > > > > > > "Sign out" link is displayed. At some point in the login code
>> I
>> > set
>> > > > > > > current_user.authenticated = True. The thing is that by the I
>> am
>> > > > > > > successfully logged in and presented with the next view, it is
>> > the
>> > > > > > > "Sign in" link that is still displayed. When I check
>> > > > > > > current_user.is_authenticated, it returns False, even though I
>> > had
>> > > > > > > explicitly set it to True. Please can anyone point out what I
>> am
>> > > > might
>> > > > > > > be doing wrong? Here is my code:
>> > > > > > >
>> > > > > > > I have a base.html file that contains the "Sign in" and "Sign
>> > out"
>> > > > > > > links that is extended by the other templates:
>> > > > > > >
>> > > > > > > <ul class="nav navbar-nav navbar-right">
>> > > > > > >    {% if (current_user.is_authenticated) %}
>> > > > > > >    <li><a href="{{ url_for('logout') }}">Sign Out</a></li>
>> > > > > > >    {% else %}
>> > > > > > >    <li><a href="{{ url_for('index') }}">Sign In</a></li>
>> > > > > > >    {% endif %}
>> > > > > > > </ul>
>> > > > > > >
>> > > > > > > <body>
>> > > > > > > {% block page_content %}{% endblock %}
>> > > > > > > </body>
>> > > > > > >
>> > > > > > >
>> > > > > > >  When the app first loads in the browser it displays a login
>> > form,
>> > > > > > > login.html:
>> > > > > > >
>> > > > > > >  {% extends "base.html" %}
>> > > > > > >
>> > > > > > > {% block content %}
>> > > > > > >     {% import "bootstrap/wtf.html" as wtf %}
>> > > > > > >     {% block title %}Flasky - Login{% endblock %}
>> > > > > > >     {% block page_content %}
>> > > > > > >     <div class="page-header">
>> > > > > > >         <h1>Login</h1>
>> > > > > > >     </div>
>> > > > > > >     <div class="col-md-4">
>> > > > > > >         {{ wtf.quick_form(form) }}
>> > > > > > >     </div>
>> > > > > > >     {% endblock %}
>> > > > > > > {% endblock %}
>> > > > > > >
>> > > > > > > When a user logs in, it loads a template dashboard.html that
>> > > displays
>> > > > > > > a map. The top part looks like this:
>> > > > > > >
>> > > > > > > {% extends "base.html" %}
>> > > > > > >
>> > > > > > > {% block page_content %}
>> > > > > > > <html>
>> > > > > > >  <head>
>> > > > > > >    <title>Lagos Map</title>
>> > > > > > >    <link rel="stylesheet"
>> > > > > > > href="https://unpkg.com/leaflet@1.1.0/dist/leaflet.css"
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> integrity="sha512-wcw6ts8Anuw10Mzh9Ytw4pylW8+NAD4ch3lqm9lzAsTxg0GFeJgoAtxuCLREZSC5lUXdVyo/7yfsqFjQ4S+aKw=="
>> > > > > > >    crossorigin=""/>
>> > > > > > >    <script src="
>> https://unpkg.com/leaflet@1.1.0/dist/leaflet.js"
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> integrity="sha512-mNqn2Wg7tSToJhvHcqfzLMU6J4mkOImSPTxVZAdo+lcPlk+GhZmYgACEe0x35K7YzW1zJ7XyJV/TT1MrdXvMcA=="
>> > > > > > >    crossorigin=""></script>
>> > > > > > >    <script
>> > > > > > > src="
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.js
>> > > > > > "></script>
>> > > > > > >    <link rel="stylesheet"
>> > > > > > > href="
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css
>> > > > > "
>> > > > > >
>> > > > > > > />
>> > > > > > >    <link rel="stylesheet"
>> > > > > > > href="
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.css
>> > > > > "
>> > > > > >
>> > > > > > > />
>> > > > > > >    <script
>> > > > > > > src="
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.js
>> > > > > > "></script>
>> > > > > > >    <script
>> > > > > > > src="
>> > https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js
>> > > > > > "></script>
>> > > > > > >   ...
>> > > > > > >   ...
>> > > > > > >
>> > > > > > > And these are the relevant routes:
>> > > > > > >
>> > > > > > > @app.route('/',methods=['GET','POST'])
>> > > > > > > def index():
>> > > > > > >       form = LoginForm()
>> > > > > > >       if form.validate_on_submit():
>> > > > > > >           user =
>> > > User.query.filter_by(email=form.email.data).first()
>> > > > > > >           if user is not None and
>> > > > > > user.check_password(form.password.data):
>> > > > > > >               user.authenticated = True
>> > > > > > >               current_user = user
>> > > > > > >               db.session.add(current_user)
>> > > > > > >               db.session.commit()
>> > > > > > >               login_user(current_user, form.remember_me.data)
>> > > > > > >               return redirect(request.args.get('next') or
>> > > > > > > url_for('dashboard'))
>> > > > > > >           flash('Invalid username or password.')
>> > > > > > >        return render_template('auth/login.html', form=form)
>> > > > > > >
>> > > > > > > @app.route('/dashboard')
>> > > > > > > def dashboard():
>> > > > > > >       return render_template("dashboard.html")
>> > > > > > >
>> > > > > > > Thank you for your time.
>> > > > > > >
>> > > > > > > _______________________________________________
>> > > > > > > Flask mailing list
>> > > > > > > Flask at python.org
>> > > > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > > >
>> > > > > > --
>> > > > > > -- Kind regards,
>> > > > > > Leni Kadali Mutungi
>> > > > > >
>> > > > > > _______________________________________________
>> > > > > > Flask mailing list
>> > > > > > Flask at python.org
>> > > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > > >
>> > > > > -------------- next part --------------
>> > > > > An HTML attachment was scrubbed...
>> > > > > URL: <
>> > > > >
>> > > >
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190702/424f55cc/attachment-0001.html
>> > > > > >
>> > > > >
>> > > > > ------------------------------
>> > > > >
>> > > > > Subject: Digest Footer
>> > > > >
>> > > > > _______________________________________________
>> > > > > Flask mailing list
>> > > > > Flask at python.org
>> > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > >
>> > > > >
>> > > > > ------------------------------
>> > > > >
>> > > > > End of Flask Digest, Vol 49, Issue 5
>> > > > > ************************************
>> > > > >
>> > > > -------------- next part --------------
>> > > > An HTML attachment was scrubbed...
>> > > > URL: <
>> > > >
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190703/c47bb246/attachment-0001.html
>> > > > >
>> > > >
>> > > > ------------------------------
>> > > >
>> > > > Message: 2
>> > > > Date: Thu, 4 Jul 2019 06:25:40 +0200
>> > > > From: Gergely Polonkai <gergely at polonkai.eu>
>> > > > To: "sidwoodstock ." <sidwoodstock at gmail.com>
>> > > > Cc: flask <Flask at python.org>
>> > > > Subject: Re: [Flask] Unable to set current_user.authenticated to
>> True
>> > > > Message-ID:
>> > > >         <
>> > > > CACczBUJaj67qxPCEi9Tmjku42QDxDsuVLmEGQGuFaC2nndT7eA at mail.gmail.com>
>> > > > Content-Type: text/plain; charset="utf-8"
>> > > >
>> > > > No, modifying current_user directly is not possible (at least it
>> won?t
>> > > > propagate outside the function). current_user is a proxy object that
>> > > points
>> > > > to the logged in user in the current request. If you assign a
>> different
>> > > > value to it, its proxy nature goes away which is definitely not what
>> > you
>> > > > want: in extreme cases it might introduce security issues where
>> users
>> > can
>> > > > access each the data of other.
>> > > >
>> > > > On Wed, 3 Jul 2019, 18:19 sidwoodstock ., <sidwoodstock at gmail.com>
>> > > wrote:
>> > > >
>> > > > > Also, if Gergely's suggestion doesn't work, you could try removing
>> > your
>> > > > > variable assignment of current_user = user. I see no practical
>> reason
>> > > to
>> > > > do
>> > > > > this, and since current_user is a built-in (and very handy)
>> variable,
>> > > > maybe
>> > > > > that is somehow related to your issue?
>> > > > >
>> > > > > > > current_user = user
>> > > > >
>> > > > > and then just call login_user directly with your user you already
>> > have
>> > > at
>> > > > > hand:
>> > > > >
>> > > > > > >               login_user(user, form.remember_me.data)
>> > > > >
>> > > > > -Scott
>> > > > >
>> > > > > On Wed, Jul 3, 2019 at 9:03 AM <flask-request at python.org> wrote:
>> > > > >
>> > > > >> Send Flask mailing list submissions to
>> > > > >>         flask at python.org
>> > > > >>
>> > > > >> To subscribe or unsubscribe via the World Wide Web, visit
>> > > > >>         https://mail.python.org/mailman/listinfo/flask
>> > > > >> or, via email, send a message with subject or body 'help' to
>> > > > >>         flask-request at python.org
>> > > > >>
>> > > > >> You can reach the person managing the list at
>> > > > >>         flask-owner at python.org
>> > > > >>
>> > > > >> When replying, please edit your Subject line so it is more
>> specific
>> > > > >> than "Re: Contents of Flask digest..."
>> > > > >>
>> > > > >>
>> > > > >> Today's Topics:
>> > > > >>
>> > > > >>    1. Re: Unable to set current_user.authenticated to True
>> > > > >>       (Gergely Polonkai)
>> > > > >>
>> > > > >>
>> > > > >>
>> > ----------------------------------------------------------------------
>> > > > >>
>> > > > >> Message: 1
>> > > > >> Date: Tue, 2 Jul 2019 19:01:20 +0200
>> > > > >> From: Gergely Polonkai <gergely at polonkai.eu>
>> > > > >> To: Leni Kadali Mutungi <lenikmutungi at gmail.com>
>> > > > >> Cc: flask <Flask at python.org>
>> > > > >> Subject: Re: [Flask] Unable to set current_user.authenticated to
>> > True
>> > > > >> Message-ID:
>> > > > >>         <CACczBUJWEAoLjnsQSh5Z+3mVuzjZ1=Ly-=
>> > > > >> zxtk3bMO+n-+-y3Q at mail.gmail.com>
>> > > > >> Content-Type: text/plain; charset="utf-8"
>> > > > >>
>> > > > >> Hello,
>> > > > >>
>> > > > >> I assume you are using Flask-Login (either directly or via
>> another
>> > > > >> extension like Flask-Security). If this is the case, you can
>> import
>> > > > >> login_user and call it like login_user(user).
>> > > > >>
>> > > > >> If that does not work, you may want to check if the user is
>> active
>> > > (ie.
>> > > > >> not
>> > > > >> disabled), as it is the most common culprit when a user can?t be
>> > > logged
>> > > > >> in.
>> > > > >>
>> > > > >> Best,
>> > > > >> Gergely
>> > > > >>
>> > > > >> On Mon, 1 Jul 2019, 19:03 Leni Kadali Mutungi, <
>> > > lenikmutungi at gmail.com>
>> > > > >> wrote:
>> > > > >>
>> > > > >> > I think you mean to set it as `current_user.is_authenticated =
>> > > True`.
>> > > > >> >
>> > > > >> > On 7/1/19 6:14 PM, Abdul Mohammed wrote:
>> > > > >> > > Hello everyone,
>> > > > >> > >                   I am trying to toggle between "Sign in" and
>> > > "Sign
>> > > > >> > > out" links using the current_user.is_authenticated variable
>> such
>> > > > that
>> > > > >> > > when it returns False, the "Sign in" is displayed and when
>> True
>> > > the
>> > > > >> > > "Sign out" link is displayed. At some point in the login
>> code I
>> > > set
>> > > > >> > > current_user.authenticated = True. The thing is that by the
>> I am
>> > > > >> > > successfully logged in and presented with the next view, it
>> is
>> > the
>> > > > >> > > "Sign in" link that is still displayed. When I check
>> > > > >> > > current_user.is_authenticated, it returns False, even though
>> I
>> > had
>> > > > >> > > explicitly set it to True. Please can anyone point out what
>> I am
>> > > > might
>> > > > >> > > be doing wrong? Here is my code:
>> > > > >> > >
>> > > > >> > > I have a base.html file that contains the "Sign in" and "Sign
>> > out"
>> > > > >> > > links that is extended by the other templates:
>> > > > >> > >
>> > > > >> > > <ul class="nav navbar-nav navbar-right">
>> > > > >> > >    {% if (current_user.is_authenticated) %}
>> > > > >> > >    <li><a href="{{ url_for('logout') }}">Sign Out</a></li>
>> > > > >> > >    {% else %}
>> > > > >> > >    <li><a href="{{ url_for('index') }}">Sign In</a></li>
>> > > > >> > >    {% endif %}
>> > > > >> > > </ul>
>> > > > >> > >
>> > > > >> > > <body>
>> > > > >> > > {% block page_content %}{% endblock %}
>> > > > >> > > </body>
>> > > > >> > >
>> > > > >> > >
>> > > > >> > >  When the app first loads in the browser it displays a login
>> > form,
>> > > > >> > > login.html:
>> > > > >> > >
>> > > > >> > >  {% extends "base.html" %}
>> > > > >> > >
>> > > > >> > > {% block content %}
>> > > > >> > >     {% import "bootstrap/wtf.html" as wtf %}
>> > > > >> > >     {% block title %}Flasky - Login{% endblock %}
>> > > > >> > >     {% block page_content %}
>> > > > >> > >     <div class="page-header">
>> > > > >> > >         <h1>Login</h1>
>> > > > >> > >     </div>
>> > > > >> > >     <div class="col-md-4">
>> > > > >> > >         {{ wtf.quick_form(form) }}
>> > > > >> > >     </div>
>> > > > >> > >     {% endblock %}
>> > > > >> > > {% endblock %}
>> > > > >> > >
>> > > > >> > > When a user logs in, it loads a template dashboard.html that
>> > > > displays
>> > > > >> > > a map. The top part looks like this:
>> > > > >> > >
>> > > > >> > > {% extends "base.html" %}
>> > > > >> > >
>> > > > >> > > {% block page_content %}
>> > > > >> > > <html>
>> > > > >> > >  <head>
>> > > > >> > >    <title>Lagos Map</title>
>> > > > >> > >    <link rel="stylesheet"
>> > > > >> > > href="https://unpkg.com/leaflet@1.1.0/dist/leaflet.css"
>> > > > >> > >
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> integrity="sha512-wcw6ts8Anuw10Mzh9Ytw4pylW8+NAD4ch3lqm9lzAsTxg0GFeJgoAtxuCLREZSC5lUXdVyo/7yfsqFjQ4S+aKw=="
>> > > > >> > >    crossorigin=""/>
>> > > > >> > >    <script src="
>> https://unpkg.com/leaflet@1.1.0/dist/leaflet.js
>> > "
>> > > > >> > >
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> integrity="sha512-mNqn2Wg7tSToJhvHcqfzLMU6J4mkOImSPTxVZAdo+lcPlk+GhZmYgACEe0x35K7YzW1zJ7XyJV/TT1MrdXvMcA=="
>> > > > >> > >    crossorigin=""></script>
>> > > > >> > >    <script
>> > > > >> > > src="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.js
>> > > > >> > "></script>
>> > > > >> > >    <link rel="stylesheet"
>> > > > >> > > href="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css
>> > > > >> "
>> > > > >> >
>> > > > >> > > />
>> > > > >> > >    <link rel="stylesheet"
>> > > > >> > > href="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.css
>> > > > >> "
>> > > > >> >
>> > > > >> > > />
>> > > > >> > >    <script
>> > > > >> > > src="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.js
>> > > > >> > "></script>
>> > > > >> > >    <script
>> > > > >> > > src="
>> > > https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js
>> > > > >> > "></script>
>> > > > >> > >   ...
>> > > > >> > >   ...
>> > > > >> > >
>> > > > >> > > And these are the relevant routes:
>> > > > >> > >
>> > > > >> > > @app.route('/',methods=['GET','POST'])
>> > > > >> > > def index():
>> > > > >> > >       form = LoginForm()
>> > > > >> > >       if form.validate_on_submit():
>> > > > >> > >           user =
>> > > User.query.filter_by(email=form.email.data).first()
>> > > > >> > >           if user is not None and
>> > > > >> > user.check_password(form.password.data):
>> > > > >> > >               user.authenticated = True
>> > > > >> > >               current_user = user
>> > > > >> > >               db.session.add(current_user)
>> > > > >> > >               db.session.commit()
>> > > > >> > >               login_user(current_user, form.remember_me.data)
>> > > > >> > >               return redirect(request.args.get('next') or
>> > > > >> > > url_for('dashboard'))
>> > > > >> > >           flash('Invalid username or password.')
>> > > > >> > >        return render_template('auth/login.html', form=form)
>> > > > >> > >
>> > > > >> > > @app.route('/dashboard')
>> > > > >> > > def dashboard():
>> > > > >> > >       return render_template("dashboard.html")
>> > > > >> > >
>> > > > >> > > Thank you for your time.
>> > > > >> > >
>> > > > >> > > _______________________________________________
>> > > > >> > > Flask mailing list
>> > > > >> > > Flask at python.org
>> > > > >> > > https://mail.python.org/mailman/listinfo/flask
>> > > > >> >
>> > > > >> > --
>> > > > >> > -- Kind regards,
>> > > > >> > Leni Kadali Mutungi
>> > > > >> >
>> > > > >> > _______________________________________________
>> > > > >> > Flask mailing list
>> > > > >> > Flask at python.org
>> > > > >> > https://mail.python.org/mailman/listinfo/flask
>> > > > >> >
>> > > > >> -------------- next part --------------
>> > > > >> An HTML attachment was scrubbed...
>> > > > >> URL: <
>> > > > >>
>> > > >
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190702/424f55cc/attachment-0001.html
>> > > > >> >
>> > > > >>
>> > > > >> ------------------------------
>> > > > >>
>> > > > >> Subject: Digest Footer
>> > > > >>
>> > > > >> _______________________________________________
>> > > > >> Flask mailing list
>> > > > >> Flask at python.org
>> > > > >> https://mail.python.org/mailman/listinfo/flask
>> > > > >>
>> > > > >>
>> > > > >> ------------------------------
>> > > > >>
>> > > > >> End of Flask Digest, Vol 49, Issue 5
>> > > > >> ************************************
>> > > > >>
>> > > > > _______________________________________________
>> > > > > Flask mailing list
>> > > > > Flask at python.org
>> > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > >
>> > > >
>> > > > On Wed, 3 Jul 2019, 18:19 sidwoodstock ., <sidwoodstock at gmail.com>
>> > > wrote:
>> > > >
>> > > > > Also, if Gergely's suggestion doesn't work, you could try removing
>> > your
>> > > > > variable assignment of current_user = user. I see no practical
>> reason
>> > > to
>> > > > do
>> > > > > this, and since current_user is a built-in (and very handy)
>> variable,
>> > > > maybe
>> > > > > that is somehow related to your issue?
>> > > > >
>> > > > > > > current_user = user
>> > > > >
>> > > > > and then just call login_user directly with your user you already
>> > have
>> > > at
>> > > > > hand:
>> > > > >
>> > > > > > >               login_user(user, form.remember_me.data)
>> > > > >
>> > > > > -Scott
>> > > > >
>> > > > > On Wed, Jul 3, 2019 at 9:03 AM <flask-request at python.org> wrote:
>> > > > >
>> > > > >> Send Flask mailing list submissions to
>> > > > >>         flask at python.org
>> > > > >>
>> > > > >> To subscribe or unsubscribe via the World Wide Web, visit
>> > > > >>         https://mail.python.org/mailman/listinfo/flask
>> > > > >> or, via email, send a message with subject or body 'help' to
>> > > > >>         flask-request at python.org
>> > > > >>
>> > > > >> You can reach the person managing the list at
>> > > > >>         flask-owner at python.org
>> > > > >>
>> > > > >> When replying, please edit your Subject line so it is more
>> specific
>> > > > >> than "Re: Contents of Flask digest..."
>> > > > >>
>> > > > >>
>> > > > >> Today's Topics:
>> > > > >>
>> > > > >>    1. Re: Unable to set current_user.authenticated to True
>> > > > >>       (Gergely Polonkai)
>> > > > >>
>> > > > >>
>> > > > >>
>> > ----------------------------------------------------------------------
>> > > > >>
>> > > > >> Message: 1
>> > > > >> Date: Tue, 2 Jul 2019 19:01:20 +0200
>> > > > >> From: Gergely Polonkai <gergely at polonkai.eu>
>> > > > >> To: Leni Kadali Mutungi <lenikmutungi at gmail.com>
>> > > > >> Cc: flask <Flask at python.org>
>> > > > >> Subject: Re: [Flask] Unable to set current_user.authenticated to
>> > True
>> > > > >> Message-ID:
>> > > > >>         <CACczBUJWEAoLjnsQSh5Z+3mVuzjZ1=Ly-=
>> > > > >> zxtk3bMO+n-+-y3Q at mail.gmail.com>
>> > > > >> Content-Type: text/plain; charset="utf-8"
>> > > > >>
>> > > > >> Hello,
>> > > > >>
>> > > > >> I assume you are using Flask-Login (either directly or via
>> another
>> > > > >> extension like Flask-Security). If this is the case, you can
>> import
>> > > > >> login_user and call it like login_user(user).
>> > > > >>
>> > > > >> If that does not work, you may want to check if the user is
>> active
>> > > (ie.
>> > > > >> not
>> > > > >> disabled), as it is the most common culprit when a user can?t be
>> > > logged
>> > > > >> in.
>> > > > >>
>> > > > >> Best,
>> > > > >> Gergely
>> > > > >>
>> > > > >> On Mon, 1 Jul 2019, 19:03 Leni Kadali Mutungi, <
>> > > lenikmutungi at gmail.com>
>> > > > >> wrote:
>> > > > >>
>> > > > >> > I think you mean to set it as `current_user.is_authenticated =
>> > > True`.
>> > > > >> >
>> > > > >> > On 7/1/19 6:14 PM, Abdul Mohammed wrote:
>> > > > >> > > Hello everyone,
>> > > > >> > >                   I am trying to toggle between "Sign in" and
>> > > "Sign
>> > > > >> > > out" links using the current_user.is_authenticated variable
>> such
>> > > > that
>> > > > >> > > when it returns False, the "Sign in" is displayed and when
>> True
>> > > the
>> > > > >> > > "Sign out" link is displayed. At some point in the login
>> code I
>> > > set
>> > > > >> > > current_user.authenticated = True. The thing is that by the
>> I am
>> > > > >> > > successfully logged in and presented with the next view, it
>> is
>> > the
>> > > > >> > > "Sign in" link that is still displayed. When I check
>> > > > >> > > current_user.is_authenticated, it returns False, even though
>> I
>> > had
>> > > > >> > > explicitly set it to True. Please can anyone point out what
>> I am
>> > > > might
>> > > > >> > > be doing wrong? Here is my code:
>> > > > >> > >
>> > > > >> > > I have a base.html file that contains the "Sign in" and "Sign
>> > out"
>> > > > >> > > links that is extended by the other templates:
>> > > > >> > >
>> > > > >> > > <ul class="nav navbar-nav navbar-right">
>> > > > >> > >    {% if (current_user.is_authenticated) %}
>> > > > >> > >    <li><a href="{{ url_for('logout') }}">Sign Out</a></li>
>> > > > >> > >    {% else %}
>> > > > >> > >    <li><a href="{{ url_for('index') }}">Sign In</a></li>
>> > > > >> > >    {% endif %}
>> > > > >> > > </ul>
>> > > > >> > >
>> > > > >> > > <body>
>> > > > >> > > {% block page_content %}{% endblock %}
>> > > > >> > > </body>
>> > > > >> > >
>> > > > >> > >
>> > > > >> > >  When the app first loads in the browser it displays a login
>> > form,
>> > > > >> > > login.html:
>> > > > >> > >
>> > > > >> > >  {% extends "base.html" %}
>> > > > >> > >
>> > > > >> > > {% block content %}
>> > > > >> > >     {% import "bootstrap/wtf.html" as wtf %}
>> > > > >> > >     {% block title %}Flasky - Login{% endblock %}
>> > > > >> > >     {% block page_content %}
>> > > > >> > >     <div class="page-header">
>> > > > >> > >         <h1>Login</h1>
>> > > > >> > >     </div>
>> > > > >> > >     <div class="col-md-4">
>> > > > >> > >         {{ wtf.quick_form(form) }}
>> > > > >> > >     </div>
>> > > > >> > >     {% endblock %}
>> > > > >> > > {% endblock %}
>> > > > >> > >
>> > > > >> > > When a user logs in, it loads a template dashboard.html that
>> > > > displays
>> > > > >> > > a map. The top part looks like this:
>> > > > >> > >
>> > > > >> > > {% extends "base.html" %}
>> > > > >> > >
>> > > > >> > > {% block page_content %}
>> > > > >> > > <html>
>> > > > >> > >  <head>
>> > > > >> > >    <title>Lagos Map</title>
>> > > > >> > >    <link rel="stylesheet"
>> > > > >> > > href="https://unpkg.com/leaflet@1.1.0/dist/leaflet.css"
>> > > > >> > >
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> integrity="sha512-wcw6ts8Anuw10Mzh9Ytw4pylW8+NAD4ch3lqm9lzAsTxg0GFeJgoAtxuCLREZSC5lUXdVyo/7yfsqFjQ4S+aKw=="
>> > > > >> > >    crossorigin=""/>
>> > > > >> > >    <script src="
>> https://unpkg.com/leaflet@1.1.0/dist/leaflet.js
>> > "
>> > > > >> > >
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> integrity="sha512-mNqn2Wg7tSToJhvHcqfzLMU6J4mkOImSPTxVZAdo+lcPlk+GhZmYgACEe0x35K7YzW1zJ7XyJV/TT1MrdXvMcA=="
>> > > > >> > >    crossorigin=""></script>
>> > > > >> > >    <script
>> > > > >> > > src="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.js
>> > > > >> > "></script>
>> > > > >> > >    <link rel="stylesheet"
>> > > > >> > > href="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://rawgit.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css
>> > > > >> "
>> > > > >> >
>> > > > >> > > />
>> > > > >> > >    <link rel="stylesheet"
>> > > > >> > > href="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.css
>> > > > >> "
>> > > > >> >
>> > > > >> > > />
>> > > > >> > >    <script
>> > > > >> > > src="
>> > > > >> >
>> > > > >>
>> > > >
>> > >
>> >
>> https://cdnjs.cloudflare.com/ajax/libs/leaflet-routing-machine/3.2.5/leaflet-routing-machine.js
>> > > > >> > "></script>
>> > > > >> > >    <script
>> > > > >> > > src="
>> > > https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js
>> > > > >> > "></script>
>> > > > >> > >   ...
>> > > > >> > >   ...
>> > > > >> > >
>> > > > >> > > And these are the relevant routes:
>> > > > >> > >
>> > > > >> > > @app.route('/',methods=['GET','POST'])
>> > > > >> > > def index():
>> > > > >> > >       form = LoginForm()
>> > > > >> > >       if form.validate_on_submit():
>> > > > >> > >           user =
>> > > User.query.filter_by(email=form.email.data).first()
>> > > > >> > >           if user is not None and
>> > > > >> > user.check_password(form.password.data):
>> > > > >> > >               user.authenticated = True
>> > > > >> > >               current_user = user
>> > > > >> > >               db.session.add(current_user)
>> > > > >> > >               db.session.commit()
>> > > > >> > >               login_user(current_user, form.remember_me.data)
>> > > > >> > >               return redirect(request.args.get('next') or
>> > > > >> > > url_for('dashboard'))
>> > > > >> > >           flash('Invalid username or password.')
>> > > > >> > >        return render_template('auth/login.html', form=form)
>> > > > >> > >
>> > > > >> > > @app.route('/dashboard')
>> > > > >> > > def dashboard():
>> > > > >> > >       return render_template("dashboard.html")
>> > > > >> > >
>> > > > >> > > Thank you for your time.
>> > > > >> > >
>> > > > >> > > _______________________________________________
>> > > > >> > > Flask mailing list
>> > > > >> > > Flask at python.org
>> > > > >> > > https://mail.python.org/mailman/listinfo/flask
>> > > > >> >
>> > > > >> > --
>> > > > >> > -- Kind regards,
>> > > > >> > Leni Kadali Mutungi
>> > > > >> >
>> > > > >> > _______________________________________________
>> > > > >> > Flask mailing list
>> > > > >> > Flask at python.org
>> > > > >> > https://mail.python.org/mailman/listinfo/flask
>> > > > >> >
>> > > > >> -------------- next part --------------
>> > > > >> An HTML attachment was scrubbed...
>> > > > >> URL: <
>> > > > >>
>> > > >
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190702/424f55cc/attachment-0001.html
>> > > > >> >
>> > > > >>
>> > > > >> ------------------------------
>> > > > >>
>> > > > >> Subject: Digest Footer
>> > > > >>
>> > > > >> _______________________________________________
>> > > > >> Flask mailing list
>> > > > >> Flask at python.org
>> > > > >> https://mail.python.org/mailman/listinfo/flask
>> > > > >>
>> > > > >>
>> > > > >> ------------------------------
>> > > > >>
>> > > > >> End of Flask Digest, Vol 49, Issue 5
>> > > > >> ************************************
>> > > > >>
>> > > > > _______________________________________________
>> > > > > Flask mailing list
>> > > > > Flask at python.org
>> > > > > https://mail.python.org/mailman/listinfo/flask
>> > > > >
>> > > > -------------- next part --------------
>> > > > An HTML attachment was scrubbed...
>> > > > URL: <
>> > > >
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190704/055df8bc/attachment.html
>> > > > >
>> > > >
>> > > > ------------------------------
>> > > >
>> > > > Subject: Digest Footer
>> > > >
>> > > > _______________________________________________
>> > > > Flask mailing list
>> > > > Flask at python.org
>> > > > https://mail.python.org/mailman/listinfo/flask
>> > > >
>> > > >
>> > > > ------------------------------
>> > > >
>> > > > End of Flask Digest, Vol 49, Issue 6
>> > > > ************************************
>> > > >
>> > > -------------- next part --------------
>> > > An HTML attachment was scrubbed...
>> > > URL: <
>> > >
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190704/89bc8e49/attachment.html
>> > > >
>> > >
>> > > ------------------------------
>> > >
>> > > Subject: Digest Footer
>> > >
>> > > _______________________________________________
>> > > Flask mailing list
>> > > Flask at python.org
>> > > https://mail.python.org/mailman/listinfo/flask
>> > >
>> > >
>> > > ------------------------------
>> > >
>> > > End of Flask Digest, Vol 49, Issue 7
>> > > ************************************
>> > >
>> > -------------- next part --------------
>> > An HTML attachment was scrubbed...
>> > URL: <
>> >
>> http://mail.python.org/pipermail/flask/attachments/20190704/04cbab56/attachment.html
>> > >
>> >
>> > ------------------------------
>> >
>> > Subject: Digest Footer
>> >
>> > _______________________________________________
>> > Flask mailing list
>> > Flask at python.org
>> > https://mail.python.org/mailman/listinfo/flask
>> >
>> >
>> > ------------------------------
>> >
>> > End of Flask Digest, Vol 49, Issue 8
>> > ************************************
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> http://mail.python.org/pipermail/flask/attachments/20190708/47a60007/attachment.html
>> >
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> Flask mailing list
>> Flask at python.org
>> https://mail.python.org/mailman/listinfo/flask
>>
>>
>> ------------------------------
>>
>> End of Flask Digest, Vol 49, Issue 11
>> *************************************
>>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20190709/6609b7c0/attachment-0001.html>


More information about the Flask mailing list