r7033 - in dumbhippo/trunk/server/src/com/dumbhippo: server/impl web/servlets
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7033 - in dumbhippo/trunk/server/src/com/dumbhippo: server/impl web/servlets
- Date: Tue, 11 Dec 2007 18:02:18 -0600 (CST)
Author: marinaz
Date: 2007-12-11 18:02:18 -0600 (Tue, 11 Dec 2007)
New Revision: 7033
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PersonViewerBean.java
dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java
Log:
Make sure we initialize authentication in FacebookSigninServlet.
Allow the Facebook information to be moved from a temporary account based on a
Facebook user id to a Mugshot account verified by the user. Mark the temporary
account as disabled.
Adjust positioning of the form and the additional options on the right of the form.
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java 2007-12-11 23:11:03 UTC (rev 7032)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/FacebookTrackerBean.java 2007-12-12 00:02:18 UTC (rev 7033)
@@ -141,7 +141,27 @@
AccountClaim ac = res.getAccountClaim();
if (ac != null) {
if (!ac.getOwner().equals(viewpoint.getViewer())) {
- throw new FacebookSystemException("Facebook account " + facebookUserId + " is claimed by someone else: " + ac.getOwner());
+ if (!ac.getOwner().getAccount().getHasAcceptedTerms()) {
+ // The only way this could happen is if we created a temporary Facebook account based on the Facebook user id,
+ // and now a user is verifying their Mugshot account from Facebook.
+ // We need to remove sentiment 'love' for the Facebook external account from it, disable it, and remove
+ // the claim of ownership on the Facebook resource, then we can add that Facebook information to the other
+ // person's account.
+ // TODO: consider checking if the temporary account had any additional external accounts set that can be
+ // added or moved to the account that is being verified.
+ try {
+ ExternalAccount ea = externalAccounts.lookupExternalAccount(new UserViewpoint(ac.getOwner(), Site.MUGSHOT), ac.getOwner(), ExternalAccountType.FACEBOOK);
+ externalAccounts.setSentiment(ea, Sentiment.INDIFFERENT);
+ ac.getOwner().getAccount().setDisabled(true);
+ em.remove(ac);
+ identitySpider.addVerifiedOwnershipClaim(viewpoint.getViewer(), res);
+ externalAccount.setExtra(Long.toString(facebookAccount.getId()));
+ } catch (NotFoundException e) {
+ throw new RuntimeException("We expected to find a Facebook external account for user " + ac.getOwner() + ", but we didn't!");
+ }
+ } else {
+ throw new FacebookSystemException("Facebook account " + facebookUserId + " is claimed by someone else: " + ac.getOwner());
+ }
} else {
throw new RuntimeException("Facebook account " + facebookUserId + " is claimed by the user " + viewpoint.getViewer() + " whose ExternalAccount for Facebook doesn't reflect the claim");
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PersonViewerBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PersonViewerBean.java 2007-12-11 23:11:03 UTC (rev 7032)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/PersonViewerBean.java 2007-12-12 00:02:18 UTC (rev 7033)
@@ -231,7 +231,7 @@
"Problem in database: contact has no resources: {}",
contact);
- // this returns only email/aim resources
+ // this returns email, AIM, XMPP, and Facebook resources
contactResources = getResourcesForPerson(contact);
// logger.debug("Contact has owner {} viewpoint is {}",
Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java 2007-12-11 23:11:03 UTC (rev 7032)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookServlet.java 2007-12-12 00:02:18 UTC (rev 7033)
@@ -302,12 +302,12 @@
"http://dogfood.mugshot.org/person?who=" + user.getId(), "target", "_blank");
xml.append(".");
} else {
- xml.appendTextNode("span", "Fill in information for the accounts you have and want to display updates from, then press 'Submit Info!'",
+ xml.appendTextNode("span", "Fill in the information for accounts you want to display updates from.",
"style", "margin-left:15px;");
}
ExternalAccountCategory currentCategory = null;
- xml.openElement("div", "style", "position:relative;width:250px;float:left;");
- xml.openElement("fb:editor", "action", "", "width", "250", "labelwidth", "90");
+ xml.openElement("div", "style", "position:relative;width:400px;float:left;");
+ xml.openElement("fb:editor", "action", "", "width", "400", "labelwidth", "120");
for (ExternalAccountView externalAccount : getSupportedAccounts(user)) {
if (currentCategory == null || !currentCategory.equals(externalAccount.getExternalAccountType().getCategory())) {
currentCategory = externalAccount.getExternalAccountType().getCategory();
@@ -362,7 +362,7 @@
xml.closeElement(); // div with the form
if (!user.getAccount().getHasAcceptedTerms()) {
- xml.openElement("div", "style", "position:relative;width:100px;float:right;color:#666666;font-weight:bold;");
+ xml.openElement("div", "style", "width:200px;float:left;color:#666666;font-weight:bold;margin-top:30px;");
xml.append("Do you already have a Mugshot account? Don't fill in this stuff, just verify" +
" your Mugshot account by following this link.");
xml.openElement("form", "action", "http://dogfood.mugshot.org/facebook-add", "target", "_blank", "method", "GET");
Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java 2007-12-11 23:11:03 UTC (rev 7032)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/FacebookSigninServlet.java 2007-12-12 00:02:18 UTC (rev 7033)
@@ -12,6 +12,7 @@
import com.dumbhippo.GlobalSetup;
import com.dumbhippo.persistence.AccountClaim;
+import com.dumbhippo.persistence.Client;
import com.dumbhippo.persistence.FacebookResource;
import com.dumbhippo.server.AccountSystem;
import com.dumbhippo.server.Configuration;
@@ -76,10 +77,11 @@
FacebookResource res = identitySpider.lookupFacebook(facebookUserId);
AccountClaim ac = res.getAccountClaim();
if (ac != null) {
- accounts.authorizeNewClient(ac.getOwner().getAccount(), SigninBean.computeClientIdentifier(request));
+ Client client = accounts.authorizeNewClient(ac.getOwner().getAccount(), SigninBean.computeClientIdentifier(request));
HttpSession sess = request.getSession(false);
if (sess != null)
sess.invalidate();
+ SigninBean.initializeAuthentication(request, response, client);
return redirectToNextPage(request, response, "/account", null);
} else {
errorMessage = "FacebookResource for " + facebookUserId + " was not claimed by any user.";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]