• Mangesh Khapre 3
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi,

I am getting error as- 
The 'LTNG_Access_Control_Challenge_Wrapper' component does not appear to contain the correct code to call the 'LTNG_Access_Control_Challenge' component.

I made guardAsleep private as-

<aura:component access="global">
    <aura:attribute name="personQuota" access="private" type="Decimal" default="25"/>
    <aura:attribute name="currentPeople" access="private" type="Decimal" default="10" />
      <!-- Global may be too permissive here, private would be better since only the CEO decides commissions -->
    <aura:attribute name="guardAsleep" access="private" type="Boolean" default="false" /> <!-- CHANGE 1-->
      
      <div class="slds-row slds-align--absolute-center">
      <div class="slds-panel slds-size--4-of-6">
        <article class="slds-card">
            <div class="slds-card__header">
                Welcome to the castle.  We have a strict quota of {!v.personQuota} citizens
            </div>
            <div class="slds-card__body">
                <ui:outputNumber value="{!v.currentPeople}"/> People<br />
                <ui:button press="{!c.attemptEntry}" label="Enter"/>
            </div>
        </article>
    </div>
  </div>
</aura:component>


and then commented the components in wrapper however this seems wrong to me, but it was not letting me save.

<aura:component implements="force:appHostable" access="global">
 <!--<c:LTNG_Access_Control_Challenge guardAsleep="{!v.sleepingGuard}"/>-->
    <div class="slds-row slds-align--absolute-center">
        <div class="slds-size--3-of-6">
            <div class="slds-row slds-align--absolute-center">
                <div class="slds-panel slds-size--4-of-6 ">
                    <h2 class="slds-text-heading--medium">Welcome to the castle.  Be warned, a guard will keep the castle from going over its person allocation</h2>
                    <ui:inputCheckbox label="Guard Asleep?" value="{!v.sleepingGuard}" />
                </div>
                <div class="slds-pabel slds-size--2-of-6">
                     <!--<c:LTNG_Access_Control_Challenge guardAsleep="{!v.sleepingGuard}"/>-->
                </div>  
            </div>
        </div>
    </div>
    <hr />
    <div class="slds-row slds-align--absolute-center">
        <div class="slds-size--4-of-6">
            <c:CodeInstructions componentName="LTNG_Access_Control_Demo" />
        </div>
    </div>
</aura:component>

Can you please what needs to be done?
Hi, I am bit stuck on this challenge

I made the attribute private and removed it from the wrapper, which I don't think is right way to do. as we just need to control the attributes access.
However, it was not letting me save it. and the challenge is failing with -

The 'LTNG_Access_Control_Challenge_Wrapper' component does not appear to contain the correct code to call the 'LTNG_Access_Control_Challenge' component.



LTNG_ACCESS_CONTROL_CHALLENGE

<aura:component access="global">
    <aura:attribute name="personQuota" access="private" type="Decimal" default="25"/>
    <aura:attribute name="currentPeople" access="private" type="Decimal" default="10" />
      <!-- Global may be too permissive here, private would be better since only the CEO decides commissions -->
      <aura:attribute name="guardAsleep" access="private" type="Boolean" default="false" /> <!-- CHANGE 1 HERE -->
      
      <div class="slds-row slds-align--absolute-center">
      <div class="slds-panel slds-size--4-of-6">
        <article class="slds-card">
            <div class="slds-card__header">
                Welcome to the castle.  We have a strict quota of {!v.personQuota} citizens
            </div>
            <div class="slds-card__body">
                <ui:outputNumber value="{!v.currentPeople}"/> People<br />
                <ui:button press="{!c.attemptEntry}" label="Enter"/>
            </div>
        </article>
    </div>
  </div>
</aura:component>

LTNG_ACCESS_CONTROL_CHALLENGE_WRAPPER

<aura:component implements="force:appHostable" access="global">
 <!--<c:LTNG_Access_Control_Challenge guardAsleep="{!v.sleepingGuard}"/>-->
    <div class="slds-row slds-align--absolute-center">
        <div class="slds-size--3-of-6">
            <div class="slds-row slds-align--absolute-center">
                <div class="slds-panel slds-size--4-of-6 ">
                    <h2 class="slds-text-heading--medium">Welcome to the castle.  Be warned, a guard will keep the castle from going over its person allocation</h2>
                    <ui:inputCheckbox label="Guard Asleep?" value="{!v.sleepingGuard}" />
                </div>
                <div class="slds-pabel slds-size--2-of-6">
                     <!--<c:LTNG_Access_Control_Challenge guardAsleep="{!v.sleepingGuard}"/>-->
                </div>  
            </div>
        </div>
    </div>
    <hr />
    <div class="slds-row slds-align--absolute-center">
        <div class="slds-size--4-of-6">
            <c:CodeInstructions componentName="LTNG_Access_Control_Demo" />
        </div>
    </div>
</aura:component>
 
In this challenge I have to use securefilter library and securely encode the date. I have made the changes as follows-

<aura:component controller="LTNG_Creatures_Controller" access="global" implements="force:appHostable"> <aura:attribute name="creatures" type="string"/> <ltng:require scripts="{!$Resource.securefilters}" /> <!-- CHANGE 1 HERE--> <div class="slds-row slds-align--absolute-center"> <div class="slds-panel slds-size--4-of-6 "> <ui:outputText value="Click the button to get all Creatures" /><BR /> <ui:button label="Get All Creatures" press="{!c.getAllCreaturesAction}"/><BR /> <BR /> <aura:unescapedHTML value="{!v.creatures}" /> </div> </div> </aura:component>

({ getAllCreaturesAction : function(component, event, helper) { var getAccountsAction = component.get("c.getAllCreatures"); getAccountsAction.setCallback(this, function(response) { var state = response.getState(); if (component.isValid() && state === "SUCCESS") { var results = response.getReturnValue(); // Let's create a beautiful table with results: var outputT = "<table class=\"slds-table slds-table--bordered slds-table--cell-buffer \">"; outputT += "<thead><tr class=\"slds-text-title--caps\">"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Id\">Id</div></th>"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Name\">Name</div></th>"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Description\">Description</div></th>"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Region\">Region</div></th>"; outputT += "</tr></thead><tbody>"; for (var i=0;i<results.length;i++) { outputT += "<tr><th scope=\"row\" data-label=\"Id\"><div class=\"slds-truncate\" title=\"Id\">" + results[i].Id + "</div></th>"; outputT += "<td data-label=\"Name\"><div class=\"slds-truncate\" title=\"Name\">" + results[i].Name + "</div></td>"; outputT += "<td data-label=\"Name\"><div class=\"slds-truncate\" title=\"Description\">" + results[i].Description__c + "</div></td>"; outputT += "<td data-label=\"Company\"><div class=\"slds-truncate\" title=\"Region\">" + results[i].Creature_Region__r.Name + "</div></td></tr>"; } outputT += "</tbody></table>"; outputT = secureFilters.html(outputT); // CHANGE 2 HERE component.set("v.creatures", outputT); } }); $A.enqueueAction(getAccountsAction); } })

However it is giving me error that -
Challenge Not yet complete... here's what's wrong: The 'LTNG_SecureFilters_Challenge' controller does not appear to be using the secureFilters resource properly.

As per my understanding this is right. what might be causing this error? any help?
Hi, I am bit stuck on this challenge

I made the attribute private and removed it from the wrapper, which I don't think is right way to do. as we just need to control the attributes access.
However, it was not letting me save it. and the challenge is failing with -

The 'LTNG_Access_Control_Challenge_Wrapper' component does not appear to contain the correct code to call the 'LTNG_Access_Control_Challenge' component.



LTNG_ACCESS_CONTROL_CHALLENGE

<aura:component access="global">
    <aura:attribute name="personQuota" access="private" type="Decimal" default="25"/>
    <aura:attribute name="currentPeople" access="private" type="Decimal" default="10" />
      <!-- Global may be too permissive here, private would be better since only the CEO decides commissions -->
      <aura:attribute name="guardAsleep" access="private" type="Boolean" default="false" /> <!-- CHANGE 1 HERE -->
      
      <div class="slds-row slds-align--absolute-center">
      <div class="slds-panel slds-size--4-of-6">
        <article class="slds-card">
            <div class="slds-card__header">
                Welcome to the castle.  We have a strict quota of {!v.personQuota} citizens
            </div>
            <div class="slds-card__body">
                <ui:outputNumber value="{!v.currentPeople}"/> People<br />
                <ui:button press="{!c.attemptEntry}" label="Enter"/>
            </div>
        </article>
    </div>
  </div>
</aura:component>

LTNG_ACCESS_CONTROL_CHALLENGE_WRAPPER

<aura:component implements="force:appHostable" access="global">
 <!--<c:LTNG_Access_Control_Challenge guardAsleep="{!v.sleepingGuard}"/>-->
    <div class="slds-row slds-align--absolute-center">
        <div class="slds-size--3-of-6">
            <div class="slds-row slds-align--absolute-center">
                <div class="slds-panel slds-size--4-of-6 ">
                    <h2 class="slds-text-heading--medium">Welcome to the castle.  Be warned, a guard will keep the castle from going over its person allocation</h2>
                    <ui:inputCheckbox label="Guard Asleep?" value="{!v.sleepingGuard}" />
                </div>
                <div class="slds-pabel slds-size--2-of-6">
                     <!--<c:LTNG_Access_Control_Challenge guardAsleep="{!v.sleepingGuard}"/>-->
                </div>  
            </div>
        </div>
    </div>
    <hr />
    <div class="slds-row slds-align--absolute-center">
        <div class="slds-size--4-of-6">
            <c:CodeInstructions componentName="LTNG_Access_Control_Demo" />
        </div>
    </div>
</aura:component>
 
In this challenge I have to use securefilter library and securely encode the date. I have made the changes as follows-

<aura:component controller="LTNG_Creatures_Controller" access="global" implements="force:appHostable"> <aura:attribute name="creatures" type="string"/> <ltng:require scripts="{!$Resource.securefilters}" /> <!-- CHANGE 1 HERE--> <div class="slds-row slds-align--absolute-center"> <div class="slds-panel slds-size--4-of-6 "> <ui:outputText value="Click the button to get all Creatures" /><BR /> <ui:button label="Get All Creatures" press="{!c.getAllCreaturesAction}"/><BR /> <BR /> <aura:unescapedHTML value="{!v.creatures}" /> </div> </div> </aura:component>

({ getAllCreaturesAction : function(component, event, helper) { var getAccountsAction = component.get("c.getAllCreatures"); getAccountsAction.setCallback(this, function(response) { var state = response.getState(); if (component.isValid() && state === "SUCCESS") { var results = response.getReturnValue(); // Let's create a beautiful table with results: var outputT = "<table class=\"slds-table slds-table--bordered slds-table--cell-buffer \">"; outputT += "<thead><tr class=\"slds-text-title--caps\">"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Id\">Id</div></th>"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Name\">Name</div></th>"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Description\">Description</div></th>"; outputT += "<th scope=\"col\"><div class=\"slds-truncate\" title=\"Region\">Region</div></th>"; outputT += "</tr></thead><tbody>"; for (var i=0;i<results.length;i++) { outputT += "<tr><th scope=\"row\" data-label=\"Id\"><div class=\"slds-truncate\" title=\"Id\">" + results[i].Id + "</div></th>"; outputT += "<td data-label=\"Name\"><div class=\"slds-truncate\" title=\"Name\">" + results[i].Name + "</div></td>"; outputT += "<td data-label=\"Name\"><div class=\"slds-truncate\" title=\"Description\">" + results[i].Description__c + "</div></td>"; outputT += "<td data-label=\"Company\"><div class=\"slds-truncate\" title=\"Region\">" + results[i].Creature_Region__r.Name + "</div></td></tr>"; } outputT += "</tbody></table>"; outputT = secureFilters.html(outputT); // CHANGE 2 HERE component.set("v.creatures", outputT); } }); $A.enqueueAction(getAccountsAction); } })

However it is giving me error that -
Challenge Not yet complete... here's what's wrong: The 'LTNG_SecureFilters_Challenge' controller does not appear to be using the secureFilters resource properly.

As per my understanding this is right. what might be causing this error? any help?
Hi all

I am unable to complete this challenge because whenever I am clicking check button, I receive the error message.
User-added image
"Challenge Not yet complete... here's what's wrong: 
It doesn't appear that you've added protection against CSRF. Make sure you re-write 
the outputlink to a commandlink that is not vulnerable to CSRF, that the action is no longer in the on-load method and the correct method is referenced by the command link"

I don't understand what is wrong. I removed the action handler from the apex:page tag and below the comment "<!-- complete challenge here -->" added command link. 
 
<apex:page controller="CSRF_Challenge" sidebar="false" tabStyle="CSRF_Challenge__tab" > <!-- action="{!approveReq}" -->
<apex:sectionHeader title="CSRF Challenge" />
<apex:form >
    <apex:pageBlock >
        <apex:pageMessages />      
        <apex:pageBlockSection title="Demo" columns="1" id="tableBlock">

            <apex:pageBlockTable value="{!Requisitions }" var="req">
                
                <!-- skipped -->    
                                             
                <apex:column headervalue="Approval Action">
                    <apex:outputLink target="_new" value="/apex/CSRF_Challenge?approve={!req.id}">Approve This Requisition</apex:outputLink>
                </apex:column>
                <apex:column headervalue="Approval Action (NO CSRF)">
                    TBD
                    <!-- complete challenge here -->
                    <apex:commandLink value="Approve This Requisition" action="{!approveReqNOCSRF}"> 
                        <apex:param name="reqId" value="{!req.id}" assignTo="{!approve}"/> 
                    </apex:commandLink>
                </apex:column>                                                                                               
            </apex:pageBlockTable>
       
        </apex:pageBlockSection>
        
        <!-- skipped -->
         
</apex:form>              
</apex:page>



Any advice?

Thanks,
Alex

Dear Colleagues,

I'm stuck in trailhead section Prevent Cross-Site Request Forgery (CSRF). While checking challenge, everytime error appears. The code works as expected. Do you have any idea what's wrong? 

<apex:page controller="CSRF_Challenge" sidebar="false" tabStyle="CSRF_Challenge__tab">
<apex:sectionHeader title="CSRF Challenge" />
<apex:form >
    <apex:pageBlock >
        <apex:pageMessages />      
        <apex:pageBlockSection title="Demo" columns="1" id="tableBlock">

            <apex:pageBlockTable value="{!Requisitions }" var="req">
                <apex:column headervalue="Castle">
                    <apex:outputfield value="{!req.Castle__c}" />
                </apex:column>             
                <apex:column headervalue="Resource">
                    <apex:outputfield value="{!req.Resource__c }" />
                </apex:column> 
                <apex:column headervalue="Quantity">
                    <apex:outputfield value="{!req.Quantity__c}" />
                </apex:column>
                <apex:column headervalue="Name">
                    <apex:outputfield value="{!req.Name}" />
                </apex:column> 
                <apex:column headervalue="Approved">
                    <apex:outputfield value="{!req.Approved__c}" />
                </apex:column>                                                  
               <apex:column headervalue="Approval Action">
                    <apex:outputLink target="_new" value="/apex/CSRF_Challenge?approve={!req.id}">Approve This Requisition</apex:outputLink>
                </apex:column>
                <apex:column headervalue="Approval Action (NO CSRF)">
                    TBD
                    <!-- complete challenge here -->
                    <apex:commandLink value="Approve This Requisition" action="{!approveReqNOCSRF}"> <apex:param name="accId" value="{!req.id}" assignTo="{!approve}"/> </apex:commandLink>
                </apex:column>                                                                                               
            </apex:pageBlockTable>
       
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Code links" columns="1">
            <apex:outputPanel >
                <ul>
                    <li><c:codeLink type="Visualforce" namespace="" name="CSRF_Challenge" description="Visualforce Page"/></li>            
                    <li><c:codeLink type="Apex" namespace="" name="CSRF_Challenge" description="Apex Controller"/></li>
                </ul>
            </apex:outputPanel>        
        </apex:pageBlockSection>        
    </apex:pageBlock>          
</apex:form>              
</apex:page>