Joomla: redirect user to Login programmatically

If you want your component function to be accessed by your user prior to login programmatically you can use the following code:

You can include the function in your helper class


You can call the function in your MVC code with the following instructions: