Foros de discusión

Custom User Login Portlet in Liferay 7

thumbnail
Julian Jupiter, modificado hace 6 años.

Custom User Login Portlet in Liferay 7

New Member Mensajes: 12 Fecha de incorporación: 24/03/17 Mensajes recientes
I created a hook for user login based on this link.

I don't understand why it seems that MVCActionCommand class is not being called when logging in. I tried to removed it but I can still login. I came to this scenario after trying my efforts to create my own form based on our required styling. I did not use the AUI Form but the HTML5 format of Bootstrap (which AUI Form becomes when generated to HTML). I find it hard to use AUI to follow our styling design (inline label for ex.). With this, I created my own validation (length and required characters) on JavaScript that it would only be submitted when email and password are in valid format. But, it never gets to the MVCActionCommand. So I'm not able to get logged in.

This is my JSP:
<portlet:actionurl name="/login/login" var="loginUrl">
	<portlet:param name="mvcRenderCommandName" value="/login/login" />
</portlet:actionurl>
<form id="form-login" class="form-horizontal" method="post" action="${loginUrl}">
                  	<div class="panel-body">
                    	<input name="saveLastPath" type="hidden" value="false">
						<input name="redirect" type="hidden" value="${redirect}">
                        <div id="form-group-email-address" class="form-group">
                        	<label for="email-address" class="col-sm-3 control-label text-right">Email</label>
                            <div class="col-sm-9">
                            	<input type="email" id="email-address" class="form-control" name="login">
                                <span id="invalid-email-address"><liferay-ui:message key="email-address.invalid" /></span>
							</div>
						</div>
                        <div id="form-group-password" class="form-group">
                        	<label for="password" class="col-sm-3 control-label text-right">Password</label>
                           	<div class="col-sm-9">
                        		<input type="password" id="password" class="form-control" name="password">
                               	<span id="invalid-password"><liferay-ui:message key="password.invalid" /></span>
                            </div>
						</div>
					</div>
                    <div class="panel-footer">
                      	<label id="label-forgot-password" class="col-sm-3">Forgot Password</label>
                        <div id="div-button" class="col-sm-9">
                       		<button type="submit" id="button-login" class="btn btn-primary pull-right">Login</button>
						</div>
					</div>
				</form>


I used the same action command as given in the above link except that I changed the parameter names based on the form. When submitted with valid format of email and password, nothing happens but shows a lot of errors on console and I'm sure it never calls the action command since it doesn't log my own logging.

Please help.
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: Custom User Login Portlet in Liferay 7

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hi Julian,

Can you share with us your Java code that contains your ActionCommand? My guess is that, if you followed that tutorial strictly, you are missing a service ranking to tell the OSGI container to prioritize YOUR service over the one that the portal ships with. If they both have the same ranking then I believe the portal one will be loaded first and thus take precedence over yours.

EDIT: Looking at the tutorial, I may be wrong because there is a different portlet referenced in the @Component. None the less, if you could provide the Java code, it will be easier to help diagnose and troubleshoot.