Expand my Community achievements bar.

SOLVED

Unable to login cq instance

Avatar

Level 3

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.

1 Accepted Solution

Avatar

Correct answer by
Level 9

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 9

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