1 2 Previous Next 17 Replies Latest reply on Oct 27, 2008 1:11 AM by javauser007

    creating our own login page

      Hi All,
      My requirement is, I need to create a portlet in that i need to create a user login form with user id and password fields followed by a submit button. through that portlet i need to enter into the portal. for that what i have done is i careated a portlet in that i create a login page with two text fields for userId and password and i craeted a button with the name Login.. then in action url which action i need to call... or else is there is any other way to do that...?

      plz help me,...

      plz post sample code if you have any....

      Regards,
      J.....

        • 1. Re: creating our own login page
          youssef.mohammed

          use this


          <input id="j_username"= type="text" name="j_username"/>

          • 2. Re: creating our own login page
            youssef.mohammed

            sorry I mean this ... my html code was swallowed in the previous reply.

            <form id="myLoginForm" name="loginform" action="j_security_check" method="post">
             <input id="j_username" type="text" value="" class="left registertext" name="j_username"/>
             <input id="j_password" type="password" value="" class="left registertext" name="j_password"/>
            </form>
            


            • 3. Re: creating our own login page

              hi youssef, thanks for your reply... But it is not working... see my below code...

              my requirement is, In my Portlet if (user=null) then login page has to be displayed in my portlet view() mode. for that my view page if(user=null) is,










              But it is not working..
              I'm getting the following error...
              org.jboss.portal.portlet.container.PortletInitializationException

              plz help me...

              • 4. Re: creating our own login page









                • 5. Re: creating our own login page

                   

                  <table align="center">
                  <form id="myLoginForm" name="loginform" action="j_security_check" method="post">
                   <input id="j_username" type="text" value="" class="left registertext" name="j_username"/>
                   <input id="j_password" type="password" value="" class="left registertext" name="j_password"/>
                  </form>
                  </table>
                  


                  • 6. Re: creating our own login page
                    ryanm13

                    try following these instructions:

                    http://wiki.jboss.org/wiki/PortletLogin

                    • 7. Re: creating our own login page
                      danielk

                      j_security_check is working for me, but with one exception. If a user input wrong credentials, he will be redirected to JBoss Portal login page. What can i do to an error message on my own site?

                      • 8. Re: creating our own login page

                        Hi Daniek...
                        Can U post the code... and is it possible to assign that login page a s a view page of user profile portlet..........? plz post the code so that we can undestand how u did.

                        • 9. Re: creating our own login page
                          danielk

                          You have already post the code in your previous answer:

                          <form id="myLoginForm" name="loginform" action="j_security_check" method="post">
                           <input id="j_username" type="text" value="" class="left registertext" name="j_username"/>
                           <input id="j_password" type="password" value="" class="left registertext" name="j_password"/>
                          </form>


                          All what i have done is paste it into my own login.xhtml, which i used as VIEW Page for my GenericFacesPortlet. If i logged in with right credentials = all fine. But if i try a wrong login, portal login page will be used and show the error message. If you are not using Richfaces like me, try to include code from above into your own JSP.

                          But is it possible to ignore this portal login page and redirect failures also to my own portlet site (login.xhtml) ? Something like that:

                          <h:outputForumat value="#{noidea.failure}" rendered="#{loginBean.failure}" />
                          <form id="myLoginForm" name="loginform" action="j_security_check" method="post">
                           <input id="j_username" type="text" value="" class="left registertext" name="j_username"/>
                           <input id="j_password" type="password" value="" class="left registertext" name="j_password"/>
                          </form>


                          • 10. Re: creating our own login page

                            hi DanielK,
                            thanks 4 ur patience.... I tried with ur code but still it is not working for me....
                            can u plz send me code as a zip file to my mail itsformine@yahoo.co.in.............

                            Regards,
                            Giri

                            • 11. Re: creating our own login page

                              hi DanielK,
                              thanks 4 ur patience.... I tried with ur code but still it is not working for me....
                              can u plz send me code as a zip file to my mail itsformine@yahoo.co.in.............

                              Regards,
                              Giri

                              • 12. Re: creating our own login page
                                danielk

                                In your login.jsp just put in that code:

                                <form action="j_security_check" method="post" enctype="UTF-8">
                                <input id="j_username" type="text" value="" name="j_username"/>
                                <input id="j_password" type="password" value="" name="j_password"/>
                                <input type="submit" value="Login" />
                                </form>


                                It is important to use "j_security_check in your action, because of container managed security. If you have not configured LoginModules in JBoss, please look first how to do that. Also important are right IDs for input fields. Take care that there are no typos.

                                If your credentials are right you will be authorized and logged in. To check whether or not logged in, you can check if renderRequest.getUserPrincipal() is not null. In Portlets i mean it was (PortletRequest) request instead of renderRequest - parameter from method you must implement in your portlet. Another possibility is to use roles and security constraints.

                                Which pages are called for wrong credentials or general errors, you can configure here:
                                [JBOSS_HOME]/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml


                                Just search for login.jsp or error.jsp.

                                Why you get an exception i can not tell you because of lack of informations. You did not say where this exception occours (Portlet, JSP another palace ?) or under which circumstances it occours.

                                I hope it helped a little bit,

                                DanielK

                                • 13. Re: creating our own login page

                                  hi DanielK,

                                  ThankQ, thanks alot... its working good..... thankQ very much for explaining all these things,..

                                  • 14. Re: creating our own login page j_security_check exception

                                    Hi Daniel,
                                    what i have done is i have added the above code as user portlet's main page(i.e overview.xhtml) some times it works good without any problem but some times it throwing the following error....


                                    HTTP Status 404 - /j_security_check
                                    
                                    type Status report
                                    
                                    message /j_security_check
                                    
                                    description The requested resource (/j_security_check) is not available.
                                    JBossWeb/2.0.1.GA
                                    
                                    
                                    can u tell me the reason?


                                    1 2 Previous Next