Skip to content

Commit

Permalink
Merge pull request #3 from KlasJoenssson/accountTypeFix
Browse files Browse the repository at this point in the history
Account type fix
  • Loading branch information
jonalv committed Aug 16, 2012
2 parents 53f0dcf + 5435415 commit 2d222ae
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -18,6 +18,7 @@
public class OpenToxLogInOutListener implements IUserManagerListener {

private IUserManager userManager;
public static String myAccountType = "";

public OpenToxLogInOutListener(IUserManager userManager) {
this.userManager = userManager;
Expand Down Expand Up @@ -51,11 +52,11 @@ private boolean updateOnLogin() {
if (userManager.isLoggedIn() && Activator.getToken() == null) {
try {
System.out.println("Logging in on OpenTox: ");
List<String> otssoAccounts = userManager.getAccountIdsByAccountTypeName(
"OpenTox OpenSSO Account"
);
List<String> otssoAccounts = userManager
.getAccountIdsByAccountTypeName( getAccountType() );
if (otssoAccounts.size() > 0) {
String account = otssoAccounts.get(0);

loginSucceeded = Activator.login(
userManager.getProperty(account, "username"),
userManager.getProperty(account, "password")
Expand Down Expand Up @@ -92,6 +93,11 @@ private void updateOnLogout() {

@Override
public String getAccountType() {
return "opentox";
if (myAccountType.isEmpty())
// TODO When the variable is initiated here it should get its name
// from the extension-point some how...
myAccountType = "OpenTox OpenSSO Account";

return myAccountType;
}
}

0 comments on commit 2d222ae

Please sign in to comment.