Re-login form on the backend

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version:
Either 4.1 or 4.2

Question:

What would be the easiest way of checking if a user is logged in still when the user click on something? And if the user is logged out, possibly login modal form can popup and the modal form can close without a page load after a login so the data won’t be lost if the user was trying to submit a form or something. I am looking for something like what SilverStripe did on the backend.
Is it possible to use the same code that SilverStripe has for the backend? If so, how do I do that?

Can anyone please help me? Thanks!

To check if a user is logged in I use:

if (Security::getCurrentUser()){}