web.identity-mgt.update_credential_final.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.wso2.carbon.identity.mgt.ui Show documentation
Show all versions of org.wso2.carbon.identity.mgt.ui Show documentation
A custom wso2 products or solution
The newest version!
<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.captcha.mgt.beans.xsd.CaptchaInfoBean" %>
<%@ page import="org.wso2.carbon.identity.mgt.ui.IdentityManagementClient" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%
String forward;
try {
String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(),
session);
ConfigurationContext configContext = (ConfigurationContext) config
.getServletContext()
.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
IdentityManagementClient client =
new IdentityManagementClient(backendServerURL, configContext);
CaptchaInfoBean captchaInfoBean = new CaptchaInfoBean();
captchaInfoBean.setSecretKey(request.getParameter("captcha-secret-key"));
captchaInfoBean.setUserAnswer(request.getParameter("captcha-user-answer"));
String userId = request.getParameter("userName");
String userKey = request.getParameter("secretKey");
String password = request.getParameter("userPassword");
boolean isCredentialsUpdated = client.updateCredential(userId, userKey,password, captchaInfoBean);
if (isCredentialsUpdated) {
session.setAttribute("update-credentials-success", "true");
forward = "../identity-mgt/success_update.jsp";
} else {
session.setAttribute("update-credentials-failed", "true");
forward = "../identity-mgt/update_credential.jsp";
}
} catch (Exception e) {
forward = "../identity-mgt/update_credential.jsp";
}
%>