liferay force theme refresh - themes

I have created theme. In this, If user logs in then he got to see his name , image etc above header.
It also contains edit profile link which redirects to page where I have placed 'Edit User' portlet. This is my custom portlet.
For showing user details in theme I have used code as:
<span>Welcome </span>
<span class="userName">$user_name</span>
<img alt="image" src="$user.getPortraitURL($themeDisplay)"/>
Edit Profile
Logout
Edit user is a spring portlet, I have used action request for updating the user.
liferayUser = UserLocalServiceUtil.getUser(themeDisplay.getUserId());
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
String email = request.getParameter("email");
if(liferayUser != null)
{
liferayUser.setFirstName(firstName);
liferayUser.setLastName(lastName);
liferayUser.setEmailAddress(email);
liferayUser.setModifiedDate(new Date());
liferayUser = UserLocalServiceUtil.updateUser(liferayUser);
logger.error(":::LR User updated:::"); }
My page is getting refreshed, user is getting updated I can able to see response on text box. But I can not able to see the changed value in the theme.
For getting the value, I have to refresh the page. In short $user_name is not getting updated value over my action. As I can able to see same name in liferay's accordion.
Is there any way to reload the theme on any action in the portlet.
I am using liferay 6.2 version.
Thanks in Advance

Related

Orbeon Form - reCAPTCHA Field required error after submitting form

I'm struggling to make reCAPTCHA work in my Orbeon form.
I'm using ORBEON 2018.2.3.201905172253 PE within SAP Commerce (Hybris).
After submitting the form, I get the error "Please check your answer to the CAPTCHA challenge" even though the captcha is correct.
Created a common Form and added reCAPTCHA as per official Orbeon documentation: https://doc.orbeon.com/form-runner/component/captcha
Added my private and public keys to the properties file
Added the reCAPTCHA property to my form:
<property
as="xs:string"
name="oxf.fr.detail.captcha.yforms.myForm"
value="reCAPTCHA"/>
This is the process executed when clicking the SUBMIT button:
<property as="xs:string" name="oxf.fr.detail.process.save-final.yforms.myForm">
validate-all
then save
then send(
uri = "https://myurl",
method = "PUT"
)
then navigate(uri = "https://myurl")
</property>
I see the reCAPTCHA at the bottom of my form as expected
When I click SUBMIT after filling up the form and completing the captcha successfully, I see a popup saying "There are validation errors. Please retry once all fields have been properly filled-out."
And the form displays this error for the captcha field:
"Please check your answer to the CAPTCHA challenge."
So I'm clearly missing something. I know there are some configurations needed for the fr-verify-done and fr-verify-error to be added, but the Orbeon documentation does not specify how to configure those through PROPERTIES. They only say how to add those event listeners while adding the captcha component by hand (editing the source code of the form through Form Builder).
Things that I tried and didn't work:
Dispatching an fr-verify event when submitting:
xf:dispatch(name = "fr-verify", targetid = "captcha")
then validate-all
then save
then send(
uri = "https://myurl",
method = "PUT"
)
then navigate(uri = "https://myurl")
Adding the reCAPTCHA component to the form source code as per Orbeon documentation:
<fr:recaptcha id="my-captcha">
<xf:send ev:event="fr-verify-done" submission="save-submission"/>
<xf:action ev:event="fr-verify-error">
<xf:toggle case="failure-case"/>
<xf:dispatch target="my-captcha" name="fr-reload"/>
</xf:action>
</fr:recaptcha>
When I click SAVE after adding the excerpt above, the Form Builder crashes. Same happens if I try to add the same excerpt to a form through the online demo form builder provided by Orbeon : https://demo.orbeon.com/demo/fr/orbeon/builder/new
That is super weird since I'm adding code provided by them using the online last version of the form builder, and it still crashes when trying to save it. So that makes me think the problem I have is not related to my platform, but with Orbeon itself.
This is the error I get in the online demo for Form Builder after adding the recaptcha excerpt to the source code of the form: "Cannot read property 'call' of undefined'
There're no relevant LOGS that I can provide, I activated debug level logs for Orbeon and I'm not getting any useful info.
I would really appreciate if someone can guide me through with either:
- Configuring the fr-verify events without changing the source code of the form using Form Builder, OR
- Adding the reCAPTCHA component through Form Builder successfully without making it crash, OR
- Anything you can come up with to make my form with captcha work
Thanks in advance,
David
SAP Hybris 6.6 includes Orbeon Forms 2017.1.1, which uses Google's reCAPTCHA 1, which Google doesn't support anymore. Your options are either:
To upgrade to a version of SAP Hybris that includes Orbeon Forms 2018.1 or 2017.2.2 or newer (those version use Google's reCAPTCHA 2).
To use the SimpleCaptcha instead of reCAPTCHA.

CAPTCHA does not look like the way it should in my contact form in Joomla

I'm new to Joomla and recently I've tried a lot to enable captcha for my contact forms and I've done all the steps to do it. (enabling captcha in Plugins,global configuration and user manager) but after all I just see this in my form:
*Security Code(Captcha)
and the code itself and the textfield to enter the captcha code are not displayed.
what should I do??? As I said I'm new to Joomla please explain step by step. By the way my site's language is Persian(Although it is not important)
this is how my form looks like after enabling captcha:
My form after enabling CAPTCHA
After 24 hours of searching on the net finally I found the answer.
Under the site's Home directory You must go to:
public_html -> plugins -> captcha -> recaptcha
and open the file named recaptcha.php.
Search for the pieces of code mentioned bellow and make the following changes:
change
const RECAPTCHA_API_SERVER = "http://api.recaptcha.net";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "api-verify.recaptcha.net";
To
const RECAPTCHA_API_SERVER = "http://www.google.com/recaptcha/api";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "www.google.com";
and also change
$response = $this->_recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/verify"
To
$response = $this->_recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify"
Then save and reload your page. it's done.
Don't forget that this is needed in Joomla 2.5 where the version of RECAPTCHA is 1.0 if your Joomla is a newer version you don't need to change anything just enable RECAPTCHA.

Is it possible to specify the page navigation using some properties kind of file in spring MVC like in JSF?

I am building a website using spring mvc. Just I built the login screen and the related controllers and services.
Now when validating the user credentials if the given password is wrong then it should navigate back to the login.jsp page. If the inputs are correct then it should navigate to userHomepage.jsp page.
I have done this as below,
try {
loginService.checkUserValidity(userId, password);
return new ModelAndView("userHomePage"); //if all the user credentials are good then redirect the user to User Home Page
} catch (UserNotExistsException e) {
loginResult = e.toString();
return new ModelAndView("login", "loginResult", loginResult);
} catch (InvalidPasswordException e) {
loginResult = e.toString();
return new ModelAndView("login", "loginResult", loginResult);
}
In the above code snippet I was hardcoding the navigating pages file names in ModelAndView (like login, userHomePage etc.,).
Is it correct approach to hardcode them? Is it possible to specify the page navigation using some properties kind of file in spring MVC like in JSF? Is spring MVC webflow sole purpose that?
Thanks
It's not unusual to hae the views specified as you have them.
If you have complex navigation you wanr to specify in an XML file, like JSF, Spring Webflow is for you. It can be tricky to set up, but provides a nice framework for complex navigation.
Have you set up Spring Security? The user is sent to the login page (form) when he's unauthorised, otherwise to the page he requested.

Reset Password Link Joomla - While in "maintenance mode" / offline mode

How do users reset passwords while in "off-line" mode.
We are running the site as Intranet.
Joomla 2.5.4
Mhm.. this is quite long to do, but maybe you can work it out.
Grant your user level offline access (you can do that in Global configuration -> Permissions)
Create a menu entry that point to the user profile and set visible to your users
Set every menu/modules etc etc invisible to "normal" users (except the previous one)
I've never tried it before, but it should work.
I just wanted to share my solution for Joomla 3.9:
In the file "offline.php" of your template (or in /templates/system if the template has no offline.php) you can place this code before where the login form is displayed:
if( JRequest::getVar('option') == 'com_users') {
?><jdoc:include type="message"/><?php
$registrationController = new UsersController();
$registrationController->display();
} else {
// Login Form
}
so it displays the dialogs to reset the password if the page is loaded by using "index.php?option=com_users&task=request.reset" or similar, but shows the "offline" login form by default.

MVC3 + WIF - FederationResult missing "wctx"

I have an MVC3 app for which I want to implement claims support. My goal is as follows:
provide a SignIn link, which when clicked displays a popup window with username/password and Facebook/WindowsLive/Google etc. links
automatically redirect to my SignIn page when a protected controller is accessed e.g. /Order/Delete
I've set up the application and providers in AppFabricLabs.com and included the STS in my project. I've also created an implementation of IAuthorizationFilter so I can mark my controllers as [WifAuth] and successfully get the OnAuthorization method called. I've implemented the use-case where the visitor has not been authenticated like this:
private static void AuthenticateUser(AuthorizationContext context)
{
var fam = FederatedAuthentication.WSFederationAuthenticationModule;
var signIn = new SignInRequestMessage(new Uri(fam.Issuer), fam.Realm);
context.Result = new RedirectResult(signIn.WriteQueryString());
}
and successfully get AppFabricLabs page with my Identity Provider choices (haven't figured out how to customise that page). When I log in my returnUrl gets called so I land in a controller method /Home/FederationResult, however the form posted to me contains only wa and wresult fields but I need wctx to know where to send the user... I haven't been able to figure out why.
the wresult is an XML document that contains (amongst a bzillion other things) the name and e-mail address of the user logging in but sadly does not contain the url to which the user was headed.
have I failed to configure something or am I just off base? thoughts anyone?
e
Just specify a Context for the SignInRequestMessage:
signIn.Context = HttpContext.Current.Request.RawUrl;
The wctx parameter is included in every request/response and also part of the form posted finally to your site.

Resources