Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#794997
Are you using classic processes from PM 2? As far as I know we no longer use the code in gulliver/js/maborak/core/maborak.js for the BPMN processes in PM 3, so you can probably just comment out the code. If I recall correctly, maborak.js does some strange stuff like redefine standard JS objects, which is probably what is causing you problems with the Google code. Comment out the Maborak code and see if you can get it to run.
#795002
Hi dear amosbatto,

I use from processmaker 3.2.1 and I want set google recaptcha code in login page of processmaker in login/login path.

I change this sources:

1. workflow\engine\skinEngine\neoclassic\layout.html :
in this source I insert this code in <head> tag :
Code: Select all
<script src='https://www.google.com/recaptcha/api.js'></script>
2. workflow\engine\xmlform\login\loginpm3.html :
In this source I insert this code in form :
Code: Select all
    <fieldset>
      <label class="panel-login">
        <div class="login_result"></div>
      </label>
      <div class="g-recaptcha" data-sitekey="6LdCACwUAAAAAF4ElSM1CTMYQo8IlSK9OByrmA1b"></div>
    </fieldset>
Now google recaptcha load correctly in login page but when I check "I'm not robot" in form, page have javascript error.
When I comment "mobarak.js" file in login page, It works true.
But I can do this ? Because when I comment it, It doesn't load in other pages after login.

Also when I comment mobarak.js file from login page I get javascript errors that are affiliated to this file like : "var leimnud = new maborak();
leimnud.make( ..."

Thanks
#795280
I don't have a public URL to try this and Google demands it for recaptcha. At any rate, try this:
At the bottom of your file workflow/engine/methods/login/login.php, change these lines from:
Code: Select all
$oHeadPublisher->addScriptFile('/jscore/src/Register.js');

G::RenderPage('publish');
To:
Code: Select all
$oHeadPublisher->addScriptFile('/jscore/src/Register.js');
$oHeadPublisher->addScriptCode("
maborak = null;
var imported = document.createElement('script');
imported.src = 'https://www.google.com/recaptcha/api.js';
document.head.appendChild(imported); 
");

G::RenderPage('publish');
Then, in your workflow/engine/xmlform/login/loginpm3.html file, use this code:
Code: Select all
    <fieldset>
      <label class="panel-login">
        <div class="login_result"></div>
      </label>
      {$form.USR_USERNAME}
      {$form.USR_PASSWORD_MASK}
      {$form.USER_LANG}
      {$form.URL}
      {$form.FAILED_LOGINS}
      <div class="g-recaptcha" data-sitekey="6LdCACwUAAAAAF4ElSM1CTMYQo8IlSK9OByrmA1b"></div>
    </fieldset>
Does that work?
#795282
Hi,

Thank you for your effort amosbatto,

But it doesn't work yet, because the "<script type="text/javascript" src="/js/maborak/core/maborak.js"></script>" is included in page and I get javascript error in "recaptcha.js" file because of interference with "mobarak.js" file.

Thanks
#795313
Did you try clearing the cache of your web browser? I don't see the conflict when I load the page, but Google tells me that I can't use reCAPTCHA, so maybe that is why I don't see the conflict.
You can undefine more things from maborak.js, if you can find what is the conflict in your web browser debugger.

The other possibility is to create your own login page and login using REST. Once the user logins in, then set the session variables in your PHP code and then redirect to a page in PM, like this:
Code: Select all
//handle login with REST here

//After successful login, then lookup the PHP session ID in the database with the access token that was obtained with login:
G::LoadClass("pmFunctions"); 
$sql = SELECT SESSION_ID FROM PMOAUTH_USER_ACCESS_TOKENS WHERE ACCESS_TOKEN='$accessToken'";
$result = executeQuery($sql);

$_SESSION['USER_LOGGED'] = $userID;
$_SESSION['USR_USERNAME'] = $username;
$_SESSION['PHPSESSID'] = $result[1]['SESSION_ID'];
header('location: ../cases/main');
#795327
Hi,

Thanks for your good help amos,

You're right. When I click on the "I',m not a robat" javascript error occurs.

I solve it.
I commented the maborak.js for login page and cerated a copy of maborak.js with maborak.login.js name, Then I commented Array.prototype.map function in new file, because this function had conflict with google recaptcha codes.
Therefore I used maborak.login.js in login page.

I think processmaker can release a plugin for use google captcha or other captcha types for login page or for web entry pages in enterprise version !

Thanks

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]