You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2011/12/28 13:34:11 UTC
Re: svn commit: r1224876 - in /ofbiz/trunk/specialpurpose/ecommerce: ./ config/ src/org/ofbiz/ecommerce/janrain/ webapp/ecommerce/ webapp/ecommerce/WEB-INF/ webapp/ecommerce/WEB-INF/actions/customer/ webapp/ecommerce/customer/
Hi Hans,
It seems to me that it's ok from a licensing POV, just wanted to check with you about commented out lines
> +#janrain.apiKey=9640f5bddc863ec419067d4bd07f9d15e45c177f
> +#janrain.baseUrl=https://ofbizdemo.rpxnow.com
> +#janrain.appName=ofbizdemo
I guess it's ok, right?
BTW I checked for Google Map, it seems using API v2 OOTB is still not a problem http://code.google.com/apis/maps/signup.html
Thanks
Jacques
> Author: hansbak
> Date: Tue Dec 27 07:39:43 2011
> New Revision: 1224876
>
> URL: http://svn.apache.org/viewvc?rev=1224876&view=rev
> Log:
> implement the basic janrain package, which enables the login via most social sites, but can not recognize if the same user if
> logged in from 2 different sites. By default this function is disabled and will not change the functionality of the OFBiz login
> procedure in any way
>
> Added:
> ofbiz/trunk/specialpurpose/ecommerce/README (with props)
> ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/
> ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java (with props)
> Modified:
> ofbiz/trunk/specialpurpose/ecommerce/build.xml
> ofbiz/trunk/specialpurpose/ecommerce/config/ecommerce.properties
> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy
> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/newcustomer.ftl
> ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/login.ftl
>
> Added: ofbiz/trunk/specialpurpose/ecommerce/README
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/README?rev=1224876&view=auto
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/README (added)
> +++ ofbiz/trunk/specialpurpose/ecommerce/README Tue Dec 27 07:39:43 2011
> @@ -0,0 +1,31 @@
> +How to use Janrain Engage Social Login.
> +======================================
> +
> +1.Get API Key from http://www.janrain.com/products/engage/social-login.
> +2.Configure file setting : ecommerce.properties you can put it
> + Example:
> + --------------------------------------------------------------------------------
> + # -- Enable janrain engage (Y/ N) default N
> + janrain.enabled=N
> +
> + # -- Janrain api key (secret)
> + janrain.apiKey=exampleKey
> +
> + # -- Janrain application domain
> + janrain.baseUrl=https://example.rpxnow.com
> +
> + # -- Janrain application name
> + janrain.appName=exampleAppName
> + --------------------------------------------------------------------------------
> +3.Restart the server.
> +
> +
> +How to test Janrain Engage Social Login.
> +=======================================
> +
> +1. Go to Login screen.
> +2. Look the Social Login Widget and you can use these existing accounts to sign-in to your website.
> +3. First time if account does not exists then system will create new account.
> +4. After account existing in the system you can use "Social Login Widget" to login account.
> +
> +===================================================================================================
>
> Propchange: ofbiz/trunk/specialpurpose/ecommerce/README
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: ofbiz/trunk/specialpurpose/ecommerce/README
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/build.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/build.xml?rev=1224876&r1=1224875&r2=1224876&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/build.xml (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/build.xml Tue Dec 27 07:39:43 2011
> @@ -41,10 +41,12 @@ under the License.
> <fileset dir="../../framework/service/build/lib" includes="*.jar"/>
> <fileset dir="../../framework/minilang/build/lib" includes="*.jar"/>
> <fileset dir="../../framework/common/build/lib" includes="*.jar"/>
> + <fileset dir="../../framework/webapp/build/lib" includes="*.jar"/>
> <fileset dir="../../applications/party/build/lib" includes="*.jar"/>
> <fileset dir="../../applications/product/build/lib" includes="*.jar"/>
> <fileset dir="../../applications/marketing/build/lib" includes="*.jar"/>
> <fileset dir="../../applications/order/build/lib" includes="*.jar"/>
> <fileset dir="../../applications/accounting/build/lib" includes="*.jar"/>
> + <fileset dir="../../applications/securityext/build/lib" includes="*.jar"/>
> </path>
> </project>
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/config/ecommerce.properties
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/config/ecommerce.properties?rev=1224876&r1=1224875&r2=1224876&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/config/ecommerce.properties (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/config/ecommerce.properties Tue Dec 27 07:39:43 2011
> @@ -17,3 +17,24 @@
> # under the License.
> ###############################################################################
> convertProductPriceCurrency=true
> +
> +############################################
> +# Janrain Engage
> +############################################
> +#example config
> +#janrain.apiKey=9640f5bddc863ec419067d4bd07f9d15e45c177f
> +#janrain.baseUrl=https://ofbizdemo.rpxnow.com
> +#janrain.appName=ofbizdemo
> +############################################
> +
> +# -- Enabled janrain engage (Y/ N) default N
> +janrain.enabled=N
> +
> +# -- Janrain api key (secret)
> +janrain.apiKey=
> +
> +# -- Janrain application domain
> +janrain.baseUrl=
> +
> +# -- Janrain application name
> +janrain.appName=
>
> Added: ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java?rev=1224876&view=auto
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java (added)
> +++ ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java Tue Dec 27 07:39:43 2011
> @@ -0,0 +1,248 @@
> +/*******************************************************************************
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *******************************************************************************/
> +package org.ofbiz.ecommerce.janrain;
> +
> +import java.io.BufferedReader;
> +import java.io.IOException;
> +import java.io.InputStreamReader;
> +import java.io.OutputStreamWriter;
> +import java.io.UnsupportedEncodingException;
> +import java.net.HttpURLConnection;
> +import java.net.MalformedURLException;
> +import java.net.URL;
> +import java.net.URLEncoder;
> +import java.util.ArrayList;
> +import java.util.HashMap;
> +import java.util.Iterator;
> +import java.util.List;
> +import java.util.Map;
> +
> +import javax.servlet.http.HttpServletRequest;
> +import javax.servlet.http.HttpServletResponse;
> +import javax.xml.parsers.ParserConfigurationException;
> +import javax.xml.xpath.XPath;
> +import javax.xml.xpath.XPathConstants;
> +import javax.xml.xpath.XPathExpressionException;
> +import javax.xml.xpath.XPathFactory;
> +
> +import javolution.util.FastMap;
> +
> +import org.ofbiz.base.util.Debug;
> +import org.ofbiz.base.util.UtilHttp;
> +import org.ofbiz.base.util.UtilMisc;
> +import org.ofbiz.base.util.UtilProperties;
> +import org.ofbiz.base.util.UtilValidate;
> +import org.ofbiz.base.util.UtilXml;
> +import org.ofbiz.entity.Delegator;
> +import org.ofbiz.entity.GenericEntityException;
> +import org.ofbiz.entity.GenericValue;
> +import org.ofbiz.webapp.control.LoginWorker;
> +import org.w3c.dom.Document;
> +import org.w3c.dom.Element;
> +import org.w3c.dom.NodeList;
> +import org.xml.sax.SAXException;
> +
> +/**
> + * Java Helper Class for Janrain Engage
> + */
> +public class JanrainHelper {
> +
> + public static final String module = JanrainHelper.class.getName();
> + private static String apiKey = UtilProperties.getPropertyValue("ecommerce.properties", "janrain.apiKey");
> + private static String baseUrl = UtilProperties.getPropertyValue("ecommerce.properties", "janrain.baseUrl");
> + public JanrainHelper(String apiKey, String baseUrl) {
> + while (baseUrl.endsWith("/"))
> + baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
> + this.apiKey = apiKey;
> + this.baseUrl = baseUrl;
> + }
> + public String getApiKey() { return apiKey; }
> + public String getBaseUrl() { return baseUrl; }
> + public static Element authInfo(String token) {
> + Map<String, Object> query = new HashMap<String, Object>();
> + query.put("token", token);
> + return apiCall("auth_info", query);
> + }
> + public HashMap<String, List<String>> allMappings() {
> + Element rsp = apiCall("all_mappings", null);
> + Element mappings_node = (Element)rsp.getFirstChild();
> + HashMap<String, List<String>> result = new HashMap<String, List<String>>();
> + NodeList mappings = getNodeList("/rsp/mappings/mapping", rsp);
> + for (int i = 0; i < mappings.getLength(); i++) {
> + Element mapping = (Element)mappings.item(i);
> + List<String> identifiers = new ArrayList<String>();
> + NodeList rk_list = getNodeList("primaryKey", mapping);
> + NodeList id_list = getNodeList("identifiers/identifier", mapping);
> + String remote_key = ((Element)rk_list.item(0)).getTextContent();
> + for (int j = 0; j < id_list.getLength(); j++) {
> + Element ident = (Element) id_list.item(j);
> + identifiers.add(ident.getTextContent());
> + }
> + result.put(remote_key, identifiers);
> + }
> + return result;
> + }
> + private NodeList getNodeList(String xpath_expr, Element root) {
> + XPathFactory factory = XPathFactory.newInstance();
> + XPath xpath = factory.newXPath();
> + try {
> + return (NodeList) xpath.evaluate(xpath_expr, root, XPathConstants.NODESET);
> + } catch (XPathExpressionException e) {
> + return null;
> + }
> + }
> + public List<String> mappings(Object primaryKey) {
> + Map<String, Object> query = new HashMap<String, Object>();
> + query.put("primaryKey", primaryKey);
> + Element rsp = apiCall("mappings", query);
> + Element oids = (Element)rsp.getFirstChild();
> + List<String> result = new ArrayList<String>();
> + NodeList nl = oids.getChildNodes();
> + for (int i = 0; i < nl.getLength(); i++) {
> + Element e = (Element)nl.item(i);
> + result.add(e.getTextContent());
> + }
> + return result;
> + }
> + public void map(String identifier, Object primaryKey) {
> + Map<String, Object> query = new HashMap<String, Object>();
> + query.put("identifier", identifier);
> + query.put("primaryKey", primaryKey);
> + apiCall("map", query);
> + }
> + public void unmap(String identifier, Object primaryKey) {
> + Map<String, Object> query = new HashMap<String, Object>();
> + query.put("identifier", identifier);
> + query.put("primaryKey", primaryKey);
> + apiCall("unmap", query);
> + }
> + private static Element apiCall(String methodName, Map<String, Object> partialQuery) {
> + Map<String, Object> query = null;
> + if (partialQuery == null) {
> + query = new HashMap<String, Object>();
> + } else {
> + query = new HashMap<String, Object>(partialQuery);
> + }
> + query.put("format", "xml");
> + query.put("apiKey", apiKey);
> + StringBuffer sb = new StringBuffer();
> + for (Iterator it = query.entrySet().iterator(); it.hasNext();) {
> + if (sb.length() > 0) sb.append('&');
> + try {
> + Map.Entry e = (Map.Entry)it.next();
> + sb.append(URLEncoder.encode(e.getKey().toString(), "UTF-8"));
> + sb.append('=');
> + sb.append(URLEncoder.encode(e.getValue().toString(), "UTF-8"));
> + } catch (UnsupportedEncodingException e) {
> + throw new RuntimeException("Unexpected encoding error", e);
> + }
> + }
> + String data = sb.toString();
> + try {
> + URL url = new URL(baseUrl + "/api/v2/" + methodName);
> + HttpURLConnection conn = (HttpURLConnection)url.openConnection();
> + conn.setRequestMethod("POST");
> + conn.setDoOutput(true);
> + conn.connect();
> + OutputStreamWriter osw = new OutputStreamWriter(
> + conn.getOutputStream(), "UTF-8");
> + osw.write(data);
> + osw.close();
> +
> + BufferedReader post = new BufferedReader(new InputStreamReader(conn.getInputStream()));
> + String line = "";
> + StringBuilder buf = new StringBuilder();
> + while ((line = post.readLine()) != null) {
> + buf.append(line);
> + }
> + post.close();
> + Document tagXml = UtilXml.readXmlDocument(buf.toString());
> + Element response = (Element) tagXml.getDocumentElement();
> + if (!response.getAttribute("stat").equals("ok")) {
> + throw new RuntimeException("Unexpected API error");
> + }
> + return response;
> + } catch (MalformedURLException e) {
> + throw new RuntimeException("Unexpected URL error", e);
> + } catch (IOException e) {
> + throw new RuntimeException("Unexpected IO error", e);
> + } catch (ParserConfigurationException e) {
> + throw new RuntimeException("Unexpected XML error", e);
> + } catch (SAXException e) {
> + throw new RuntimeException("Unexpected XML error", e);
> + }
> + }
> +
> + public static String janrainCheckLogin(HttpServletRequest request, HttpServletResponse response){
> + Delegator delegator = (Delegator) request.getAttribute("delegator");
> + String token = request.getParameter("token");
> + String errMsg = "";
> + if (UtilValidate.isNotEmpty(token)) {
> + JanrainHelper janrainHelper = new JanrainHelper(apiKey, baseUrl);
> + Element authInfo = janrainHelper.authInfo(token);
> + Element profileElement = UtilXml.firstChildElement(authInfo, "profile");
> + Element nameElement = UtilXml.firstChildElement(profileElement, "name");
> +
> + // profile element
> + String displayName = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "displayName"));
> + String email = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "email"));
> + String identifier = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "identifier"));
> + String preferredUsername = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "preferredUsername"));
> + String providerName = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "providerName"));
> + String url = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "url"));
> +
> + // name element
> + String givenName = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "givenName"));
> + String familyName = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "familyName"));
> + String formatted = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "formatted"));
> +
> + if (UtilValidate.isEmpty("preferredUsername")) {
> + errMsg = UtilProperties.getMessage("SecurityextUiLabels", "loginevents.username_not_found_reenter",
> UtilHttp.getLocale(request));
> + request.setAttribute("_ERROR_MESSAGE_", errMsg);
> + return "error";
> + }
> +
> + Map<String, String> result = FastMap.newInstance();
> + result.put("displayName", displayName);
> + result.put("email", email);
> + result.put("identifier", identifier);
> + result.put("preferredUsername", preferredUsername);
> + result.put("providerName", providerName);
> + result.put("url", url);
> + result.put("givenName", givenName);
> + result.put("familyName", familyName);
> + result.put("formatted", formatted);
> + request.setAttribute("userInfoMap", result);
> +
> + try {
> + GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId",
> preferredUsername));
> + if (UtilValidate.isNotEmpty(userLogin)) {
> + LoginWorker.doBasicLogin(userLogin, request);
> + LoginWorker.autoLoginSet(request, response);
> + return "success";
> + } else {
> + return "userLoginMissing";
> + }
> + } catch (GenericEntityException e) {
> + Debug.logError(e, "Error finding the userLogin for distributed cache clear", module);
> + }
> + }
> + return "success";
> + }
> +}
>
> Propchange: ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java
> ------------------------------------------------------------------------------
> svn:keywords = Date Rev Author URL Id
>
> Propchange: ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy?rev=1224876&r1=1224875&r2=1224876&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy Tue Dec 27 07:39:43 2011
> @@ -16,6 +16,7 @@
> * specific language governing permissions and limitations
> * under the License.
> */
> +
> import org.ofbiz.base.util.UtilProperties;
> import org.ofbiz.base.util.UtilMisc;
> import org.ofbiz.product.store.ProductStoreWorker;
> @@ -49,3 +50,21 @@ if (previousParams) {
> previousParams = "";
> }
> context.previousParams = previousParams;
> +
> +//the parameters from janrain
> +userInfoMap = request.getAttribute("userInfoMap");
> +if (!userInfoMap) {
> + userInfoMap = request.getSession().getAttribute("userInfoMap");
> +}
> +if (userInfoMap) {
> + if (userInfoMap.givenName && userInfoMap.familyName) {
> + requestParameters.USER_FIRST_NAME = userInfoMap.givenName;
> + requestParameters.USER_LAST_NAME = userInfoMap.familyName;
> + } else if (userInfoMap.formatted) {
> + requestParameters.USER_FIRST_NAME = userInfoMap.formatted;
> + }
> + requestParameters.CUSTOMER_EMAIL = userInfoMap.email;
> + requestParameters.preferredUsername = userInfoMap.preferredUsername;
> + requestParameters.USERNAME = userInfoMap.preferredUsername;
> + request.getSession().setAttribute("userInfoMap", userInfoMap);
> +}
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=1224876&r1=1224875&r2=1224876&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Tue Dec 27 07:39:43 2011
> @@ -2012,7 +2012,7 @@ under the License.
> <security https="true" auth="false"/>
> <response name="success" type="view" value="showShoppingList" save-current-view="true"/>
> </request-map>
> -
> +
> <!-- Product Tags -->
> <request-map uri="addProductTags">
> <security https="false" auth="false"/>
> @@ -2020,7 +2020,16 @@ under the License.
> <response name="success" type="view-last" save-current-view="true"/>
> <response name="error" type="view-last" save-current-view="true"/>
> </request-map>
> -
> +
> + <!-- ============== Janrain Engage ============== -->
> + <request-map uri="janrainCheckLogin">
> + <security https="true" auth="false"/>
> + <event type="java" path="org.ofbiz.ecommerce.janrain.JanrainHelper" invoke="janrainCheckLogin"/>
> + <response name="success" type="view" value="main"/>
> + <response name="error" type="view" value="login"/>
> + <response name="userLoginMissing" type="request" value="newcustomer"/>
> + </request-map>
> +
> <!-- End of Request Mappings -->
>
> <!-- View Mappings -->
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/newcustomer.ftl
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/newcustomer.ftl?rev=1224876&r1=1224875&r2=1224876&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/newcustomer.ftl (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/newcustomer.ftl Tue Dec 27 07:39:43 2011
> @@ -342,15 +342,22 @@ will generally always be reserved for th
> <legend><#if getUsername>${uiLabelMap.CommonUsername}</#if></legend>
> <#if getUsername>
> <@fieldErrors fieldName="USERNAME"/>
> - <div class="form-row inline">
> - <label for="UNUSEEMAIL">
> - <input type="checkbox" class="checkbox" name="UNUSEEMAIL" id="UNUSEEMAIL" value="on" onclick="setEmailUsername();"
> onfocus="setLastFocused(this);"/> ${uiLabelMap.EcommerceUseEmailAddress}
> - </label>
> - </div>
> + <#if !requestParameters.preferredUsername?has_content>
> + <div class="form-row inline">
> + <label for="UNUSEEMAIL">
> + <input type="checkbox" class="checkbox" name="UNUSEEMAIL" id="UNUSEEMAIL" value="on" onclick="setEmailUsername();"
> onfocus="setLastFocused(this);"/> ${uiLabelMap.EcommerceUseEmailAddress}
> + </label>
> + </div>
> + </#if>
>
> <div>
> <label for="USERNAME">${uiLabelMap.CommonUsername}*</label>
> - <input type="text" name="USERNAME" id="USERNAME" value="${requestParameters.USERNAME?if_exists}"
> onfocus="clickUsername();" onchange="changeEmail();"/>
> + <#if requestParameters.preferredUsername?has_content>
> + <input type="text" name="showUserName" id="showUserName" value="${requestParameters.USERNAME?if_exists}"
> disabled="disabled"/>
> + <input type="hidden" name="USERNAME" id="USERNAME" value="${requestParameters.USERNAME?if_exists}"/>
> + <#else>
> + <input type="text" name="USERNAME" id="USERNAME" value="${requestParameters.USERNAME?if_exists}"
> onfocus="clickUsername();" onchange="changeEmail();"/>
> + </#if>
> </div>
> </#if>
> </fieldset>
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/login.ftl
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/login.ftl?rev=1224876&r1=1224875&r2=1224876&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/login.ftl (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/login.ftl Tue Dec 27 07:39:43 2011
> @@ -16,35 +16,102 @@ KIND, either express or implied. See th
> specific language governing permissions and limitations
> under the License.
> -->
> +<#assign janrainEnabled = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("ecommerce.properties",
> "janrain.enabled")>
> +<#assign appName = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("ecommerce.properties", "janrain.appName")>
> +<#if janrainEnabled == "Y">
> +<script type="text/javascript">
> +(function() {
> + if (typeof window.janrain !== 'object') window.janrain = {};
> + window.janrain.settings = {};
> +
> + janrain.settings.tokenUrl = '<@ofbizUrl fullPath="true" secure="true">janrainCheckLogin</...@ofbizUrl>';
>
> + function isReady() { janrain.ready = true; };
> + if (document.addEventListener) {
> + document.addEventListener("DOMContentLoaded", isReady, false);
> + } else {
> + window.attachEvent('onload', isReady);
> + }
> +
> + var e = document.createElement('script');
> + e.type = 'text/javascript';
> + e.id = 'janrainAuthWidget';
> +
> + if (document.location.protocol === 'https:') {
> + e.src = 'https://rpxnow.com/js/lib/${appName}/engage.js';
> + } else {
> + e.src = 'http://widget-cdn.rpxnow.com/js/lib/${appName}/engage.js';
> + }
> +
> + var s = document.getElementsByTagName('script')[0];
> + s.parentNode.insertBefore(e, s);
> +})();
> +</script>
> <h1>${uiLabelMap.CommonLogin}</h1>
> <div class="screenlet">
> <div class="screenlet-title-bar"><h3>${uiLabelMap.CommonRegistered}</h3></div>
> <div class="screenlet-body">
> - <form method="post" action="<@o...@ofbizUrl>" name="loginform" class="horizontal">
> - <fieldset>
> - <div>
> - <label for="userName">${uiLabelMap.CommonUsername}</label>
> - <input type="text" id="userName" name="USERNAME" value="<#if
> requestParameters.USERNAME?has_content>${requestParameters.USERNAME}<#elseif
> autoUserLogin?has_content>${autoUserLogin.userLoginId}</#if>"/>
> - </div>
> -<#if autoUserLogin?has_content>
> - <p>(${uiLabelMap.CommonNot} ${autoUserLogin.userLoginId}? <a
> href="<@o...@ofbizUrl>">${uiLabelMap.CommonClickHere}</a>)</p>
> -</#if>
> - <div>
> - <label for="password">${uiLabelMap.CommonPassword}:</label>
> - <input type="password" id="password" name="PASSWORD" value=""/>
> - </div>
> - <div>
> - <input type="submit" class="button" value="${uiLabelMap.CommonLogin}"/>
> - </div>
> - <div>
> - <label for="newcustomer_submit">${uiLabelMap.CommonMayCreateNewAccountHere}:</label>
> - <a href="<@o...@ofbizUrl>">${uiLabelMap.CommonMayCreate}</a>
> - </div>
> - </fieldset>
> - </form>
> + <table width="100%" class="Signlogin">
> + <tr>
> + <td>
> + <form method="post" action="<@o...@ofbizUrl>" name="loginform" class="horizontal">
> + <fieldset>
> + <div>
> + <label for="userName">${uiLabelMap.CommonUsername}</label>
> + <input type="text" id="userName" name="USERNAME" value="<#if
> requestParameters.USERNAME?has_content>${requestParameters.USERNAME}<#elseif
> autoUserLogin?has_content>${autoUserLogin.userLoginId}</#if>"/>
> + </div>
> + <#if autoUserLogin?has_content>
> + <p>(${uiLabelMap.CommonNot} ${autoUserLogin.userLoginId}? <a
> href="<@o...@ofbizUrl>">${uiLabelMap.CommonClickHere}</a>)</p>
> + </#if>
> + <div>
> + <label for="password">${uiLabelMap.CommonPassword}:</label>
> + <input type="password" id="password" name="PASSWORD" value=""/>
> + </div>
> + <div>
> + <input type="submit" class="button" value="${uiLabelMap.CommonLogin}"/>
> + </div>
> + <div>
> + <label for="newcustomer_submit">${uiLabelMap.CommonMayCreateNewAccountHere}:</label>
> + <a href="<@o...@ofbizUrl>">${uiLabelMap.CommonMayCreate}</a>
> + </div>
> + </fieldset>
> + </form>
> + </td>
> + <td><div id="janrainEngageEmbed"></div></td>
> + </tr>
> + </table>
> </div>
> </div>
> +<#else>
> +<h1>${uiLabelMap.CommonLogin}</h1>
> +<div class="screenlet">
> + <div class="screenlet-title-bar"><h3>${uiLabelMap.CommonRegistered}</h3></div>
> + <div class="screenlet-body">
> + <form method="post" action="<@o...@ofbizUrl>" name="loginform" class="horizontal">
> + <fieldset>
> + <div>
> + <label for="userName">${uiLabelMap.CommonUsername}</label>
> + <input type="text" id="userName" name="USERNAME" value="<#if
> requestParameters.USERNAME?has_content>${requestParameters.USERNAME}<#elseif
> autoUserLogin?has_content>${autoUserLogin.userLoginId}</#if>"/>
> + </div>
> + <#if autoUserLogin?has_content>
> + <p>(${uiLabelMap.CommonNot} ${autoUserLogin.userLoginId}? <a
> href="<@o...@ofbizUrl>">${uiLabelMap.CommonClickHere}</a>)</p>
> + </#if>
> + <div>
> + <label for="password">${uiLabelMap.CommonPassword}:</label>
> + <input type="password" id="password" name="PASSWORD" value=""/>
> + </div>
> + <div>
> + <input type="submit" class="button" value="${uiLabelMap.CommonLogin}"/>
> + </div>
> + <div>
> + <label for="newcustomer_submit">${uiLabelMap.CommonMayCreateNewAccountHere}:</label>
> + <a href="<@o...@ofbizUrl>">${uiLabelMap.CommonMayCreate}</a>
> + </div>
> + </fieldset>
> + </form>
> + </div>
> +</div>
> +</#if>
>
> <div class="screenlet">
> <div class="screenlet-title-bar"><h3>${uiLabelMap.CommonForgotYourPassword}</h3></div>
>
>