Plugin: Login

Can someone explain to me the first line of this code is doing and where is the location? It is from ‘message.html.twig’ login plugin.

{% for message in grav.messages.fetch %}

full code

{% for message in grav.messages.fetch %}
<div class="{{ message.scope|e }} alert">{{ message.message|raw }}</div>
{% endfor %}

Also, I think the login plugin script needs a tweak. When requesting for a reset in password, any valid email email address will show message

Instructions to reset your password have been sent via email
But it is false. With the message set, and you jump back and forth between the login and forgot password screen, that message still appears.

Messages is an object set on the Grav object, and then fetch is a method to get the messages from the object if they exist.