com.objectplanet.survey.plugin.interfaces
Interface ISurveyLogin


public interface ISurveyLogin

Interface for the survey login functionality.

A class that implements this interface will be called if the login for this plugin is enabled in the survey.

Author:
Torgeir Lund
Created:
January 14, 2004

Method Summary
 boolean checkLogin(long surveyId, java.util.HashMap Resources)
          Validates the login.
 java.lang.String getLoginScreen(long surveyId, java.util.HashMap resources)
          Gets the login screen for the survey.
 

Method Detail

getLoginScreen

java.lang.String getLoginScreen(long surveyId,
                                java.util.HashMap resources)
Gets the login screen for the survey. This is HTML code (or other type of coding when this is implemented). The code must include all HTML needed between the form tags. For example, the code could be:
   Name: <input type=text name=plugin_login length=10><br>
   Password: <input type=password name=plugin_pw length=10>
   <input type=submit value="login" name=plugin_loginButton>
  
As can be seen from this example code, all input field names must start with "plugin". This is to avoid any conflicts with any fields produced by Opinio. The example includes two fields: "plugin_login" and "plugin_pw". When The user enters the values and clicks the button (must also be provided in the code), Opinio will receive the form and return it through a call to the checkLogin() method of this interface. It is then up to the plugin to validate the login by returning true/false.

NOTE: This method could be used to display a message. If the checkLogin() method returns false, then the getLoginScreen() method is called. That means that you can use this interface in a plugin to stop respondents on certain criteria.

Parameters:
surveyId - Id of the survey
resources - This HashMap contains both the HttpRequest and HttpResponse objects, if the current survey is web based. In future versions, other types of objects must be retrieved, if other protocols are used - WAP, for example. The HTTP objects must be retrieved this way:
      HttpRequest request = (HttpRequest) resources.get("HttpRequest");
      -- or --
      HttpResponse response = (HttpResponse) resources.get("HttpResponse");
                       
Then these objects should contain the values needed to display the login screen. In most cases, no values are needed at all, but you may want to display some default login name from a cookie, for example.
Returns:
The loginScreen coding (HTML or other)

checkLogin

boolean checkLogin(long surveyId,
                   java.util.HashMap Resources)
Validates the login. This method is called before getLoginScreen(), in case the plugin author wants to auto-login or block users on certain criteria.

Parameters:
surveyId - Id of the survey
Resources - This HashMap contains both the HttpRequest and HttpResponse objects, if the current survey is web based. In future versions, other types of objects must be retrieved, if other protocols are used - WAP, for example. The HTTP objects must be retrieved this way:
      HttpRequest request = (HttpRequest) resources.get("HttpRequest");
      -- or --
      HttpResponse response = (HttpResponse) resources.get("HttpResponse");
                       
Then these objects should contain the values needed validate the login, by retrieving the login/pw from the request object, and validating it towards an LDAP directory, for example.
Returns:
True if login OK, false otherwise (getLoginScreen() will be called)

Copyright ? ObjectPlanet Inc. All Rights Reserved.

Built on December 20 2016