Note: In order to use the features described in this article you must have a Multi-User Manager account with Therabill. The information within does not apply to any other accounts. Contact sales@therabill.com for more information on setting up a Multi-User Manager account.
Owners of a Therabill Multi-User Manager account have access to special features that allow you to provide login forms for their provider accounts, user accounts, and client accounts from your clinic's website. This feature is flexible enough that it can be implemented with some basic web programming utilizing the example below or customized for those with access to more advanced programming.
Basic Login Form Requirements
There are 3 required inputs and 1 optional input for adding the form to your site.
Required
- un - a text input that accepts the username that the user is attempting to login with
- up - a password input that accepts the password for the user
- authkey - a hidden input that passes your unique authorization key associated with your Multi-User Manager account
Optional
- passbackerror - an optional hidden input that allows us to send any errors back to your site
By default, the error is displayed on a Therabill page.
The final component to setup your form is that it must be coded to send the data using an HTML POST to https://www.therabill.com/login/login_verify_external.php
Example Basic Code - the bare minimum
<!-- the login form - note that this must be a post -->
<form action="https://www.therabill.com/login/verify_login_external.php" method="post">
<!-- an example of the un input -->
Username: <input type="text" id="un" name="un" /><br />
<!-- an example of the up input -->
Password: <input type="password" id="up" name="up" /><br />
<!-- an example button to submit the login form -->
<input type="submit" value="Go" />
<!-- an example hidden input holding your Multi-User Manager authorization key XXXXXXX -->
<!-- replace XXXXXXX with your actual authorization key -->
<input type="hidden" id="authkey" name="authkey" value="XXXXXXX" />
</form>
Error Messages
There are 3 error messages that are presented depending on the error type.
- ERROR: This page can only receive posts. Consult your implementation guide for details.
This error applies if you do not send the form as a post (i.e. method="POST" in your form code) - ERROR: One or more of the expected fields is empty. Consult your implementation guide for details.
This error applies if you do not have the 3 required fields properly setup and are passing data (i.e. the user leaves the password blank or you have authkey2 instead of authkey) - Your login was bad or the account you are attempting to login to is not authorized for this website.
This error will trigger if the username/password are incorrect or if the account they are attempting to log in to is not associated with the Multi-User Manager Authorization key that you have sent in your form. (i.e. only accounts that your Multi-User Manager account has access to can login through your form)
Advanced Login Form Setup
The only requirements are the 3 inputs mentioned above and a POST to the correct url. Other than that, the rest is up to you. Styling, validation before sending the login, and using javascript or any dynamic server language is all available since this will be on your site.
Example Basic Code using Javascript to accept the login errors
<html><head>
<script type="text/javascript">
// the following is a function to parse the query string for the error parameter
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(decodeURIComponent(pair[0]) == variable){showBadLogin(decodeURIComponent(pair[1]));}
}
return(false);
}
// the following is an example javascript function to display any errors
function showBadLogin(msg){
var bldiv = document.getElementById("BADLOGIN");
bldiv.style.display = 'inline';
bldiv.innerHTML = msg;
}
</script>
</head>
<!-- onload call the javascript function to check for a query parameter -->
<body onload="getQueryVariable('error')">
<!-- this div holds the error messages -->
<div id="BADLOGIN" style="display:none">BAD LOGIN</div>
<!-- the login form - note that this must be a post -->
<form action="https://www.therabill.com/login/verify_login_external.php" method="post">
<!-- an example of the un input -->
Username: <input type="text" id="un" name="un" /><br />
<!-- an example of the up input -->
Password: <input type="password" id="up" name="up" /><br />
<!-- an example button to submit the login form -->
<input type="submit" value="Go" />
<!-- an example hidden input holding your Multi-User Manager authorization key XXXXXXX -->
<!-- replace XXXXXXX with your actual authorization key -->
<input type="hidden" id="authkey" name="authkey" value="XXXXXXX" />
<!-- an example optional hidden input to pass the errors back to -->
<!-- replace https://example.com with whatever your login page is -->
<!-- changing ?error= to something else will require changing the onload function call above -->
<input type="hidden" id="passbackerror" name="errorpassback" value="https://example.com?error=" />
</form>
</body>
</html>
Comments
0 comments
Article is closed for comments.