Android Open Source - Fon Fon Login






From Project

Back to project page Fon.

License

The source code is released under:

GNU General Public License

If you think the Android project Fon listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.rsalvaterra.fon.login;
/*from   w ww.  ja  v a 2s.  co m*/
import org.rsalvaterra.fon.HttpUtils;
import org.rsalvaterra.fon.ResponseCodes;

final class FonLogin {

  static LoginResult login(final String user, final String password) {
    int responseCode = ResponseCodes.WISPR_RESPONSE_CODE_ACCESS_GATEWAY_INTERNAL_ERROR;
    String replyMessage = null;
    String logoffUrl = null;
    String content = HttpUtils.getUrl(LoginManager.CONNECTION_TEST_URL);
    if (content != null) {
      if (!content.equals(LoginManager.CONNECTED)) {
        content = LoginManager.getFonXML(content);
        if (content != null) {
          final FonInfoHandler wih = new FonInfoHandler();
          if (LoginManager.parseFonXML(content, wih) && (wih.getMessageType() == ResponseCodes.WISPR_MESSAGE_TYPE_INITIAL_REDIRECT) && (wih.getResponseCode() == ResponseCodes.WISPR_RESPONSE_CODE_NO_ERROR)) {
            content = LoginManager.getFonXMLByPost(wih.getLoginURL(), user, password);
            if (content != null) {
              final FonResponseHandler wrh = new FonResponseHandler();
              if (LoginManager.parseFonXML(content, wrh)) {
                responseCode = wrh.getResponseCode();
                if (responseCode == ResponseCodes.WISPR_RESPONSE_CODE_LOGIN_SUCCEEDED) {
                  logoffUrl = wrh.getLogoffURL();
                } else if (responseCode == ResponseCodes.WISPR_RESPONSE_CODE_LOGIN_FAILED) {
                  responseCode = wrh.getFonResponseCode();
                  replyMessage = wrh.getReplyMessage();
                }
              }
            } else if (LoginManager.isConnected()) {
              responseCode = ResponseCodes.WISPR_RESPONSE_CODE_LOGIN_SUCCEEDED;
              logoffUrl = LoginManager.DEFAULT_LOGOFF_URL;
            }
          }
        } else {
          responseCode = ResponseCodes.CUST_WISPR_NOT_PRESENT;
        }
      } else {
        responseCode = ResponseCodes.CUST_ALREADY_CONNECTED;
        logoffUrl = LoginManager.DEFAULT_LOGOFF_URL;
      }
    }
    return new LoginResult(responseCode, replyMessage, logoffUrl);
  }

}




Java Source Code List

org.rsalvaterra.fon.Actions.java
org.rsalvaterra.fon.HttpUtils.java
org.rsalvaterra.fon.IntentHandlingService.java
org.rsalvaterra.fon.ResponseCodes.java
org.rsalvaterra.fon.WifiIntentReceiver.java
org.rsalvaterra.fon.activity.AdvancedPreferences.java
org.rsalvaterra.fon.activity.BasicPreferences.java
org.rsalvaterra.fon.login.FonInfoHandler.java
org.rsalvaterra.fon.login.FonLogin.java
org.rsalvaterra.fon.login.FonResponseHandler.java
org.rsalvaterra.fon.login.LivedoorLogin.java
org.rsalvaterra.fon.login.LoginManager.java
org.rsalvaterra.fon.login.LoginResult.java
org.rsalvaterra.fon.login.SFRLogin.java