cancel
Showing results for 
Search instead for 
Did you mean: 

4.2.c I want modify the login page to add a check box

bisana
Champ on-the-rise
Champ on-the-rise
Hi All
I am trying out 4.2.c, I want to customise the login page to add a check box[ some read me links], which when user clicks only he able to login.
I need advice in modifying the loing page to add the check box. I have searched the system for the login.* files in share, but I do not know which files to modify. It will be great help if I get advice

following are the list of files with login.* search

/opt/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-data/page-types/login.xml
/opt/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/guest/login.get.desc.xml
/opt/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/guest/login.get.html.ftl
/opt/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/guest/login.get.js
/opt/alfresco/tomcat/webapps/share/components/guest/login.js
/opt/alfresco/tomcat/webapps/share/components/guest/login.css


Guidance and adivce requested

13 REPLIES 13

mitpatoliya
Star Collaborator
Star Collaborator
I think it should be login.get.html.ftl file
try removing some of the field from that and check the effects

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi,

First of all, enable Surf Bug and navigate to the login page, that way you can easily see what the login page is made up of.

I believe you have several options:

1. Create in $TOMCAT_HOME/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/guest/login.get.html.ftl, exactly with the same content as the original one and perform your customizations.

2. Create an extension module which override <@markup id="html"> with you custom content. Something like:


<extension>
   <modules>
      <module>
         <id>Tacit Knowledge - Guest customizations module</id>
         <auto-deploy>true</auto-deploy>
         <customizations>
            <customization>
               <targetPackageRoot>org.alfresco.components.guest</targetPackageRoot>
               <sourcePackageRoot>your.custom.package.components.guest</sourcePackageRoot>
            </customization>
         </customizations>
      </module>
   </modules>
</extension>


And:

<@markup id="html">
   <@uniqueIdDiv>
      <#assign el=args.htmlid?html>
      <div id="${el}-body" class="theme-overlay login hidden">
     
      <@markup id="header">
         <div class="theme-company-logo"></div>
      </@markup>
     
      <#if errorDisplay == "container">
      <@markup id="error">
         <#if error>
         <div class="error">${msg("message.loginautherror")}</div>
         <#else>
         <script type="text/javascript">//<![CDATA[
            document.cookie = "_alfTest=_alfTest";
            var cookieEnabled = (document.cookie.indexOf("_alfTest") !== -1);
            if (!cookieEnabled)
            {
               document.write('<div class="error">${msg("message.cookieserror")}</div>');
            }
         //]]></script>
         </#if>
      </@markup>
      </#if>
     
      <@markup id="form">
         <form id="${el}-form" accept-charset="UTF-8" method="post" action="${url.context}/page/dologin" class="form-fields">
            <@markup id="fields">
            <input type="hidden" id="${el}-success" name="success" value="${successUrl?html}"/>
            <input type="hidden" name="failure" value="${url.context}/page/type/login?error=true"/>
            <div class="form-field">
               <label for="${el}-username">${msg("label.username")}</label><br/>
               <input type="text" id="${el}-username" name="username" maxlength="255" value="<#if lastUsername??>${lastUsername?html}</#if>" />
            </div>
            <div class="form-field">
               <label for="${el}-password">${msg("label.password")}</label><br/>
               <input type="password" id="${el}-password" name="password" maxlength="255" />
            </div>
            </@markup>
            <@markup id="buttons">
            <div class="form-field">
               <input type="submit" id="${el}-submit" class="login-button" value="${msg("button.login")}"/>
            </div>
            </@markup>
         </form>
      </@markup>
     
      <@markup id="footer">
         <span class="faded tiny">${msg("label.copyright")}</span>
      </@markup>

      </div>
   </@>
</@>


3. If you want to avoid code duplication, another possible approach could be define an extension module which appends your custom content just after the "components" region (you can see it using surf bug). Once you have it, perhaps you can play with styles and custom JavaScript for capturing events etc.

You can read more about extensions in http://docs.alfresco.com/4.2/topic/com.alfresco.enterprise.doc/concepts/Surf_v4_components_Share.htm... and http://blogs.alfresco.com/wp/ddraper/.

Hop it helps.

Regards.

Hi,
I want to login to the Dashboard with google username and password can you please help me!!!!!

bisana
Champ on-the-rise
Champ on-the-rise
Hi alejandrogarciasec,mitpatoliya
Your input was valid, and your help is appreciated by me.
I will try out this and update the forum

bisana
Champ on-the-rise
Champ on-the-rise
Hi
I checked it, it involves some level of web programming.
I will prefer to do the option 1, editing 'login.get.html.ftl' . I need to have free template editing knowledge on FreeMarker Template for me is not there. I am going to first start understanding and see how freemarker template works and then edit the file

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi bisana,

Right, option 1 is the easiest one so if it is the solution best suits for you go for it.

Regards.

Hi,

your post is helpful for me. I added textbox in login.get.html.ftl . I want to Validate textbox.

which when user enters something only he able to login. Thanks in Advance...

gerezgher
Champ in-the-making
Champ in-the-making
That was helpful for me too. That was great explanation.

Glad to hear about that Smiley Happy

Cheers.