This extension provides a login portlet named
XLoginPortlet that provides user login functionality.
XLoginPortlet extends from XPortlet. It provides a login form that requires users to enter username and password. It then uses UserIdentity (can be customized) to perform the actual authentication. If successful, it will login the user and reload the current page.
protected/extensions. Make sure a
loginsub-directory is generated.
XLoginPortlet is a widget that can be placed in a controller view or layout view as follows:
$this->widget('application.extensions.login.XLoginPortlet',array( 'visible'=>Yii::app()->user->isGuest, ));
By default, it assumes a user identity class
UserIdentity can be found at
application.components.UserIdentity. If your application is using a different user identity class, you will need to configure the
identityClass property of
XLoginPortlet in the above.
In the above, we set the
visible property to be true only when the user is not logged in. As a result, if the user has successfully logged in, the login portlet will disappear.