r7285 - in dumbhippo/trunk/server: src/com/dumbhippo/server src/com/dumbhippo/server/impl src/com/dumbhippo/web src/com/dumbhippo/web/pages src/com/dumbhippo/web/servlets web/javascript/dh web/tags/3



Author: marinaz
Date: 2008-02-04 18:02:59 -0600 (Mon, 04 Feb 2008)
New Revision: 7285

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/server/impl/InvitationSystemBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/SigninBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/UserSigninBean.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/pages/AccountPage.java
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/VerifyServlet.java
   dumbhippo/trunk/server/web/javascript/dh/account.js
   dumbhippo/trunk/server/web/tags/3/accountEditTable.tag
   dumbhippo/trunk/server/web/tags/3/accountStatus.tag
Log:
Only disable the Mugshot account if the user has a GNOME Online account
and disables their account on the Mugshot account page.

Disable both GNOME Online and Mugshot accounts if the user desables their 
GNOME Online account.

Display helpful messages about reenabling the accounts.

Don't enable Mugshot account automatically when the user gets authenticated
on the Mugshot site, have them do it manually on the Account page.

Make sure account page content is disabled when the account is disabled.

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/IdentitySpider.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -7,6 +7,7 @@
 import javax.ejb.Local;
 
 import com.dumbhippo.Pair;
+import com.dumbhippo.Site;
 import com.dumbhippo.identity20.Guid;
 import com.dumbhippo.identity20.Guid.ParseException;
 import com.dumbhippo.live.LiveUser;
@@ -389,7 +390,7 @@
 	
 	public boolean getAccountDisabled(User user);
 	
-	public void setAccountDisabled(User user, boolean disabled);
+	public void setAccountDisabled(User user, Site site, boolean disabled);
 	
 	public boolean getAccountAdminDisabled(User user);
 	

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/HttpMethodsBean.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -696,7 +696,7 @@
 	
 	public void doSetAccountDisabled(UserViewpoint viewpoint, boolean disabled)
 			throws IOException, HumanVisibleException {
-		identitySpider.setAccountDisabled(viewpoint.getViewer(), disabled);
+		identitySpider.setAccountDisabled(viewpoint.getViewer(), viewpoint.getSite(), disabled);
 	}
 
 	public void doSetPassword(UserViewpoint viewpoint, String password) throws IOException,
@@ -1238,10 +1238,6 @@
 	
 	public void doAcceptTerms(UserViewpoint viewpoint) {
 		viewpoint.getViewer().getAccount().setHasAcceptedTerms(true);	
-		// TODO: we can check if we are accepting terms of use from online.gnome.org here
-		// and not set publicPage to true, but we would also need a different place where
-		// we would set it to true (possibly when the person visits there Mugshot account
-		// page for the first time).
 		if (viewpoint.getViewer().getAccount().getAccountType() == AccountType.MUGSHOT) {
 		    viewpoint.getViewer().getAccount().setPublicPage(true);
 		}

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/IdentitySpiderBean.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -22,6 +22,7 @@
 
 import com.dumbhippo.GlobalSetup;
 import com.dumbhippo.Pair;
+import com.dumbhippo.Site;
 import com.dumbhippo.TypeUtils;
 import com.dumbhippo.identity20.Guid;
 import com.dumbhippo.identity20.Guid.ParseException;
@@ -31,6 +32,7 @@
 import com.dumbhippo.live.UserPrefChangedEvent;
 import com.dumbhippo.persistence.Account;
 import com.dumbhippo.persistence.AccountClaim;
+import com.dumbhippo.persistence.AccountType;
 import com.dumbhippo.persistence.Administrator;
 import com.dumbhippo.persistence.AimResource;
 import com.dumbhippo.persistence.Contact;
@@ -988,9 +990,15 @@
 		return user.getAccount().isDisabled();
 	}
 
-	public void setAccountDisabled(User user, boolean disabled) {
+	public void setAccountDisabled(User user, Site site, boolean disabled) {
 		Account account = getAttachedAccount(user);
-		if (account.isDisabled() != disabled) {
+		if (site == Site.MUGSHOT && account.getAccountType() == AccountType.GNOME) {
+			if (account.isPublicPage() == disabled) {
+			    account.setPublicPage(!disabled);
+			    logger.debug("Public page flag toggled to {} on account {}", !disabled,
+					         account);
+			}
+		} else if (account.isDisabled() != disabled) {
 			account.setDisabled(disabled);
 			logger.debug("Disabled flag toggled to {} on account {}", disabled,
 					account);

Modified: dumbhippo/trunk/server/src/com/dumbhippo/server/impl/InvitationSystemBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/server/impl/InvitationSystemBean.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/server/impl/InvitationSystemBean.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -620,7 +620,7 @@
 		
 		Account acct = accounts.createAccountFromResource(invitationResource, site.getAccountType());
 		if (disable) {
-			identitySpider.setAccountDisabled(acct.getOwner(), true);
+			identitySpider.setAccountDisabled(acct.getOwner(), site, true);
 		}
 
 		Client client = null;

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/SigninBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/SigninBean.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/SigninBean.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -189,8 +189,6 @@
 		// terms of use, we should make their page public.
 		if (site.getAccountType() == AccountType.GNOME)
 			account.setAccountType(AccountType.GNOME);
-		else if (site.getAccountType() == AccountType.MUGSHOT && account.getHasAcceptedTerms())
-			account.setPublicPage(true);
 		
 		if (account.isActive()) {
 			setCookie(site, response, user.getGuid(), client.getAuthKey());
@@ -224,8 +222,6 @@
 		// as "a hack to use DAV with apps that don't use the browser cookies"
 		if (site.getAccountType() == AccountType.GNOME)
 			account.setAccountType(AccountType.GNOME);
-		else if (site.getAccountType() == AccountType.MUGSHOT && account.getHasAcceptedTerms())
-			account.setPublicPage(true);
 		
 		if (account.isActive()) {
 			;
@@ -259,8 +255,6 @@
 				// not using mugshot.org explicitly; this is only called from HttpMethodsServlet2
 				if (site.getAccountType() == AccountType.GNOME)
 					account.setAccountType(AccountType.GNOME);
-				else if (site.getAccountType() == AccountType.MUGSHOT && account.getHasAcceptedTerms())
-					account.setPublicPage(true);
 				
 				if (account.isActive())
 					setCookie(site, response, userId, client.getAuthKey());
@@ -328,6 +322,16 @@
 		return server;
 	}
 	
+    public String getBaseUrlGnome() {
+		Configuration config = WebEJBUtil.defaultLookup(Configuration.class);
+    	return config.getBaseUrlGnome().toExternalForm();
+    }
+    
+    public String getBaseUrlMugshot() {
+		Configuration config = WebEJBUtil.defaultLookup(Configuration.class);
+    	return config.getBaseUrlMugshot().toExternalForm();
+    }
+    
 	public Site getSite() {
 		return site;
 	}

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/UserSigninBean.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/UserSigninBean.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/UserSigninBean.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -99,7 +99,7 @@
 	
 	@Override
 	public boolean isActive() {
-		return getUser().getAccount().isActive();
+		return getUser().getAccount().isActive() && (getSite() == Site.GNOME || getUser().getAccount().isPublicPage());
 	}
 	
 	@Override

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/pages/AccountPage.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/pages/AccountPage.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/pages/AccountPage.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -406,12 +406,4 @@
     public List<XmppResource> getClaimedXmppResources() {
     	return claimVerifier.getPendingClaimedResources(signin.getUser(), XmppResource.class);
     }
-    
-    public String getBaseUrlGnome() {
-    	return config.getBaseUrlGnome().toExternalForm();
-    }
-    
-    public String getBaseUrlMugshot() {
-    	return config.getBaseUrlMugshot().toExternalForm();
-    }
 }

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/VerifyServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/VerifyServlet.java	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/VerifyServlet.java	2008-02-05 00:02:59 UTC (rev 7285)
@@ -67,7 +67,7 @@
 				if (signin.isValid()) {
 					UserViewpoint viewpoint = (UserViewpoint)signin.getViewpoint();
 					IdentitySpider spider = WebEJBUtil.defaultLookup(IdentitySpider.class);
-					spider.setAccountDisabled(viewpoint.getViewer(), true);
+					spider.setAccountDisabled(viewpoint.getViewer(), viewpoint.getSite(), true);
 					// now on to /account as normal
 				} else {
 					// just send them to the /account page where they can disable, not

Modified: dumbhippo/trunk/server/web/javascript/dh/account.js
===================================================================
--- dumbhippo/trunk/server/web/javascript/dh/account.js	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/web/javascript/dh/account.js	2008-02-05 00:02:59 UTC (rev 7285)
@@ -822,7 +822,11 @@
 dhAccountInit = function() {
 	if (!dh.account.active) {
 	    // we want to disable editing, but still display all the data we have
-		dh.dom.disableChildren(document.getElementById("dhAccountContents"));
+	    if (dh.util.exists('dhAccountContents'))
+		    dh.dom.disableChildren(document.getElementById('dhAccountContents'));
+		
+		if (dh.util.exists('gnomeAccountContents'))    
+		    dh.dom.disableChildren(document.getElementById('gnomeAccountContents'));
 	}
 	
 	if (dh.util.exists('dhUsernameEntry')) {

Modified: dumbhippo/trunk/server/web/tags/3/accountEditTable.tag
===================================================================
--- dumbhippo/trunk/server/web/tags/3/accountEditTable.tag	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/web/tags/3/accountEditTable.tag	2008-02-05 00:02:59 UTC (rev 7285)
@@ -40,7 +40,7 @@
 	        <div class="dh-section-explanation">
 	            This information will be visible on your <a href="/person">Home</a> page.
 	            <c:if test="${dh:enumIs(signin.user.account.accountType, 'GNOME')}">
-	                You can modify your name, picture, and other information on your <a href="${account.baseUrlGnome}/account">GNOME Online</a> account page.
+	                You can modify your name, picture, and other information on your <a href="${signin.baseUrlGnome}/account">GNOME Online</a> account page.
 	            </c:if>
 	        </div>
         </dht3:formTableRowSeparator>    
@@ -195,14 +195,17 @@
 	    <dht2:formTableRow label="Mugshot" icon="/images3/${buildStamp}/mugshot_icon.png" altRow="true">
 	    <div class="dh-account-preferences-row">
 			<c:choose>
+			    <c:when test="${signin.user.account.disabled && signin.user.account.publicPage}">
+			        Disabled because your GNOME Online account is disabled
+			    </c:when>
 			    <c:when test="${signin.user.account.publicPage}">
-			        Enabled <a href="${account.baseUrlMugshot}/account">Visit Your Account</a>    
+			        Enabled <a href="${signin.baseUrlMugshot}/account">Visit Your Account</a>    
 			    </c:when>
 			    <c:otherwise>
-			        Disabled <a href="${account.baseUrlMugshot}/account">Log in to Enable</a>  
+			        Disabled <a href="${signin.baseUrlMugshot}/account">Log in to Enable</a>  
 			    </c:otherwise>
 			</c:choose>    
-			(<a href="${account.baseUrlMugshot}/features">Learn more</a>)
+			(<a href="${signin.baseUrlMugshot}/features">Learn more</a>)
 		</div>	
 	    </dht2:formTableRow>
 	</c:if>

Modified: dumbhippo/trunk/server/web/tags/3/accountStatus.tag
===================================================================
--- dumbhippo/trunk/server/web/tags/3/accountStatus.tag	2008-02-04 16:00:09 UTC (rev 7284)
+++ dumbhippo/trunk/server/web/tags/3/accountStatus.tag	2008-02-05 00:02:59 UTC (rev 7285)
@@ -27,11 +27,21 @@
 		<div id="dhAccountDisabled">
 			<span class="dh-account-disabled-header">Your account is currently disabled.</span>  
 			<c:choose>
+			    <c:when test="${dh:enumIs(site, 'MUGSHOT') && dh:enumIs(signin.user.account.accountType, 'GNOME')}">
+			        Got to your <a href="${signin.baseUrlGnome}/account">GNOME Online</a> account page to reenable it.
+			    </c:when> 
 				<c:when test="${!enableControl}">
 					Go to <a href="/account">My Account</a> to reenable it.
 				</c:when>
 				<c:otherwise>
-					The information on your <c:out value="${site.siteName}"/> pages is not visible to anybody else. 
+				    <c:choose>
+			            <c:when test="${dh:enumIs(site, 'GNOME')}">
+					        The information on your <c:out value="${site.siteName}"/> page is not visible to anybody else. 
+                        </c:when>
+					    <c:otherwise>
+					        The information on your <c:out value="${site.siteName}"/> pages is not visible to anybody else. 
+					    </c:otherwise>
+					</c:choose>    
 					Reenable your account to use all of <c:out value="${site.siteName}"/>'s features. 
                     <p>
                     	<a href="javascript:dh.actions.enableAccount()">Reenable my account</a>
@@ -40,6 +50,23 @@
 			</c:choose>
 		</div>
 	</c:when>	
+	<c:when test="${!signin.needsTermsOfUse && !signin.user.account.publicPage && dh:enumIs(site, 'MUGSHOT')}">
+		<div id="dhAccountDisabled">
+			<span class="dh-account-disabled-header">Your Mugshot account is currently disabled.</span>  
+			<c:choose>
+				<c:when test="${!enableControl}">
+					Go to <a href="/account">My Account</a> to reenable it.
+				</c:when>
+				<c:otherwise>
+					The information on your Mugshot pages is not visible to anybody else. 
+					Enable your account to use all of Mugshot's features. 
+                    <p>
+                    	<a href="javascript:dh.actions.enableAccount()">Enable my Mugshot account</a>
+                    </p>
+                </c:otherwise>
+			</c:choose>
+		</div>	
+	</c:when>
 	<c:when test="${signin.needsTermsOfUse || (includeDownload && signin.user.account.needsDownload)}">
 	<c:set scope="request" var="accountStatusShowing" value="true"/>
 		<div id="dhAccountStatus">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]