掲示板

How to add a field in login page in liferay??

9年前 に Azhar md によって更新されました。

How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
Hi all,
I want to add another field other than email-address and user-name
ex:
current login page of liferay 6.2 is

email-address or user-id:
password:

i want it to be
company name: (my property) <this should be authenticated i.e it should check from db>
user-name (i changed this in login page from screen-name to user-name): (liferay property)
password: (liferay property)

Kindly help
thumbnail
9年前 に Pankaj Kathiriya によって更新されました。

RE: How to add a field in login page in liferay??

Liferay Master 投稿: 722 参加年月日: 10/08/05 最新の投稿
You can write hook plugin to add company field in login-screen and by overriding struts-action for login functionality you can make db check for company name.
Refer link
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
first of all thank u for replying

i am completely new to liferay can you please give me some example or code
thumbnail
9年前 に Jitendra Rajput によって更新されました。

RE: How to add a field in login page in liferay??

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
thank u for replying..
just explain how i check with the db??

thanks.
thumbnail
9年前 に Jitendra Rajput によって更新されました。

RE: How to add a field in login page in liferay??

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
Get company object from company name or web id using ComapnyLocalServiceUtil and validate the same with current company .

You can get the current company details from themeDisplay.
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
Hi jitendra rajput thank for your reply but i want some precise example,

i created a user and added him to an organization say the user is in XXX organization.

I want to validate i.e
company name (organization): <organization which i created in liferay and added a user. it should get validate from the organization that i have created in liferay>
user name:
password:
thumbnail
9年前 に Jitendra Rajput によって更新されました。

RE: How to add a field in login page in liferay??

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
You can get the Group object by passing organization name using GroupLocalServiceUtil.

Once you have Group object you can get group id and validate this group id with themeDisplay.getScopeGroupId().

Hope this will help you,
Jitendra
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
Thank you again jitendra rajput,

Just tell me how to validate from the organization not from group. because i have created a organization and added the users.
the user should enter his organization, user name and password then he/she should be validated whether he is in organization, user name is correct password is fine like that..
kindly help..
thumbnail
9年前 に Jitendra Rajput によって更新されました。

RE: How to add a field in login page in liferay??

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
Just tell me how to validate from the organization not from group. because i have created a organization and added the users.


group_ table has records for Organization , site and User groups as well. When every you create organization , site or user group details are getting recorded in group_ table as well.

There is no direct method in GroupLocaServiceUtil to get organization by passing organization name (you can get if you have organization id).

You can use OrganizationLocalServiceUtil.getOrganization(long companyId, java.lang.String name) to get organization by name.

Thank you,
Jitendra
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
i tried to print in console using this code
for (Role listItem : roles) {
System.out.println(listItem.getName());
String roleName = listItem.getName();
Organization org = OrganizationLocalServiceUtil.getOrganization(listItem.getCompanyId(), listItem.getUserName());
System.out.println(org);
}

but i get exception like
com.liferay.portal.NoSuchOrganizationException: No Organization exists with the key {companyId=10157, name=}
at com.liferay.portal.service.persistence.OrganizationPersistenceImpl.findByC_N(OrganizationPersistenceImpl.java:5694)
at com.liferay.portal.service.impl.OrganizationLocalServiceImpl.getOrganization(OrganizationLocalServiceImpl.java:558)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
at com.sun.proxy.$Proxy56.getOrganization(Unknown Source)
at com.liferay.portal.service.OrganizationLocalServiceUtil.getOrganization(OrganizationLocalServiceUtil.java:782)
at com.liferay.custom.action.CustomPostLoginAction.run(CustomPostLoginAction.java:60)
at com.liferay.portal.kernel.events.InvokerAction.run(InvokerAction.java:41)
at com.liferay.portal.events.EventsProcessorImpl.processEvent(EventsProcessorImpl.java:83)
at com.liferay.portal.events.EventsProcessorImpl.process(EventsProcessorImpl.java:69)
at com.liferay.portal.events.EventsProcessorUtil.process(EventsProcessorUtil.java:40)
at com.liferay.portal.servlet.MainServlet.loginUser(MainServlet.java:1006)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:466)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:359)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:724)
thumbnail
9年前 に Jitendra Rajput によって更新されました。

RE: How to add a field in login page in liferay??

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
Error is coming because you are passing in correct value in
Organization org = OrganizationLocalServiceUtil.getOrganization(listItem.getCompanyId(), listItem.getUserName());
method.

Why are you iterating roles and passing user name to get organization name ?
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
Hi jitendra rajput,

Thank you for pinpointing me..
but how do i get the company id then??
is this way correct??

User user = PortalUtil.getUser(httpreq);

System.out.println(user.getOrganizations());
i got a list
and my organization name was there emoticon

[{uuid=b2936975-ebf3-4e0d-b340-7dcf57887ba1, organizationId=12402, companyId=10157, userId=10201, userName=Test Test, createDate=Thu Dec 11 09:37:35 GMT 2014, modifiedDate=Thu Dec 11 09:39:00 GMT 2014, parentOrganizationId=0, treePath=/12402/, name=12, type=regular-organization, recursable=true, regionId=0, countryId=0, statusId=12017, comments=}]

first of all thanks jitendra rajput..
now how do i validate in login.jsp??
9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
i also got only organization name by this code
User user = PortalUtil.getUser(httpreq);
List<Organization> org=user.getOrganizations();
for(Organization orglist: org){
System.out.println(orglist.getName());
}
it displayed my organization nameemoticon
but how i validate in login.jsp page??emoticon


here is my login.jsp
i have added a field

//company name <organization name>
<aui:input name="company" showRequiredLabel="<%= false %>" type="text" value= " ">
<aui:validator name="required" />
</aui:input>

//liferay property <user-name>
<aui:input autoFocus="<%= windowState.equals(LiferayWindowState.EXCLUSIVE) || windowState.equals(WindowState.MAXIMIZED) %>" cssClass="clearable" label="<%= loginLabel %>" name="login" showRequiredLabel="<%= false %>" type="text" value="<%= login %>">
<aui:validator name="required" />
</aui:input>

kindly help
9年前 に Eswaran R によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 82 参加年月日: 14/12/29 最新の投稿
how to validate organization name in new field
kindly help me...........

添付ファイル:

9年前 に Azhar md によって更新されました。

RE: How to add a field in login page in liferay??

Junior Member 投稿: 59 参加年月日: 14/12/01 最新の投稿
Hi,
Happy new year to all,

Hope this year my issue will be solved.

thanks,
Azhar