Unable to login cq instance | Community
Skip to main content
Level 3
October 16, 2015
Solved

Unable to login cq instance

  • October 16, 2015
  • 1 reply
  • 981 views

I have requirement to change password implimentation on our project.

took password fields  with new component after entering password fields and after submition  am sending these values through ajax to servlet. the below code i have used .

try {

        Session session = repository.loginAdministrative(null);
            String name = request.getParameter("userID");

        
            String passwordOld = request.getParameter("password");

            String passwordNew = request.getParameter("Changepassword");
        
            
            User user;
   
            UserManager userManager = AccessControlUtil.getUserManager(session);

            Authorizable authorizable = userManager.getAuthorizable(name);
 
            if (authorizable instanceof User) {            
   
                user = (User) authorizable;
                user.changePassword(passwordNew);

            } else {

                throw new ResourceNotFoundException(

                "User could not be determined");

            }
            
            
  
        }

        catch (Exception e) {

            log.error("------------ ---------changePasswordForUser fianl exception.---------------------"
                    + e.getMessage());

        }

I have build the bundle after logout and tried with default user logins but unable to login cq page.

Getting this errors

org.apache.sling.auth.core.impl.SlingAuthenticator getAnonymousResolver: Anonymous access not allowed by configuration - requesting credentials
org.apache.sling.auth.core.impl.SlingAuthenticator handleLoginFailure: Unable to authenticate null: UserId/Password mismatch.

 

That will be great help of your precious help.

 

Thanks,

Rahul.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mshaji

It seems that you haven't saved session, make a call to session.save()  in your code then try again

1 reply

MshajiCommunity AdvisorAccepted solution
Community Advisor
October 16, 2015

It seems that you haven't saved session, make a call to session.save()  in your code then try again