Created
July 1, 2017 16:54
-
-
Save sgaem/913f5440aee2201c7f2dd9e1ba112ede to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.aem.sgaem.project.servlets; | |
import com.adobe.cq.account.api.AccountManagementService; | |
import java.io.IOException; | |
import javax.jcr.RepositoryException; | |
import org.apache.felix.scr.annotations.Reference; | |
import org.apache.felix.scr.annotations.sling.SlingServlet; | |
import org.apache.sling.api.SlingHttpServletRequest; | |
import org.apache.sling.api.SlingHttpServletResponse; | |
import org.apache.sling.api.servlets.SlingAllMethodsServlet; | |
@SlingServlet(paths = "/bin/requestPassword") | |
public class RequestPassword extends SlingAllMethodsServlet { | |
@Reference | |
private AccountManagementService accountManagementService; | |
@Override | |
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) { | |
try { | |
String userId = request.getParameter("userId"); | |
accountManagementService | |
.requestPasswordReset(userId, "http://localhost:4502", | |
"/content/resetPasswordProperties"); | |
response.getWriter().print("Your request for change password is sent to your mail id"); | |
} catch (RepositoryException e) { | |
e.getStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment