Custom external login form

Note: This does not work for users with 2-Factor-Authentication enabled.

The following is a PHP code snippet that displays a login form which provides feedback without showing the FileRun login screen. This can be used if you would like to have a custom login form integrated into your website and bypass the FileRun login screen.

<?php
if ($_GET[['feedback']]) {
     echo base64_decode($_GET[['feedback']]);
}
?>
<form method="post" action="URL-OF-FILERUN/">
	<input type="hidden" name="filerun_login_action" value="1">
	<label for="usr">Username:</label>
	<input type="text" name="username" value="" id="usr">
	<label for="pass">Password:</label>
	<input type="password" name="password" value="" id="pass">
	<input type="submit" value="Login">
</form>

You will need to replace URL-OF-FILERUN with the actual URL.

You can also make the login Ajax-based, in which case the HTTP request is identical, but the target URL should not contain the &nonajax=1 part. The server response will then be in JSON format.

Redirect after login

If you wish to have the user directed to another page instead of the FileRun user interface, you do so by defining the redirection URL inside the configuration file:

$config['app']['login']['redirect_url'] = 'http://www.your-site.com/your-success-page.html?'; //leave the question mark at its end
 
$config['app']['login']['redirect_url_failure'] = 'http://www.your-site.com/your-error-page.html?'; //leave the question mark at its end

If you wish to set the redirect URL in a dynamic way, you do it in your custom PHP file like this:

session_name('FileRunSID');
session_start();
$_SESSION['FileRun']['AuthRedirect'] = 'http://www.your-site.com/your-success-page.html?';
//here either redirect the user to the FileRun login form or display your custom login form