6525036 Super Contributor.
Super Contributor.
858 views

FF and Looping

It is very strange.

The form below loops with a form fill policy.

If I chose not to submit it, it correctly fills out username and password, and I can just click the login button.

What on earth can be wrong?


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Organisation - Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./plugins/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="./css/login.css">
<script src="./plugins/jquery/jquery-1.12.4.min.js" type="text/javascript"></script>
<script src="./plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="./js/login.js" type="text/javascript"></script>
</head>
<body>
<div class="container">

<form class="form-login" name="form-login">
<h3 class="form-login-heading">Login</h3>
<label for="username" class="sr-only">Brugernavn</label>
<input type="text" id="username" name="username" class="form-control" placeholder="Brugernavn" required="" autofocus="">
<label for="password" class="sr-only">Password</label>
<input type="password" id="password" name="password" class="form-control" placeholder="Password" required="">
<button type="submit" id="login-btn" class="btn btn-lg btn-primary btn-block" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Logger ind...">Login</button>
<div id="error">Login mislykkedes. Kontroller venligst brugernavn og kodeord.</div>
</form>
</div>
</body>
</html>
0 Likes
9 Replies
ScorpionSting Absent Member.
Absent Member.

Re: FF and Looping

6525036;2495850 wrote:
It is very strange.

The form below loops with a form fill policy.

If I chose not to submit it, it correctly fills out username and password, and I can just click the login button.

What on earth can be wrong?


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Organisation - Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./plugins/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="./css/login.css">
<script src="./plugins/jquery/jquery-1.12.4.min.js" type="text/javascript"></script>
<script src="./plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="./js/login.js" type="text/javascript"></script>
</head>
<body>
<div class="container">

<form class="form-login" name="form-login">
<h3 class="form-login-heading">Login</h3>
<label for="username" class="sr-only">Brugernavn</label>
<input type="text" id="username" name="username" class="form-control" placeholder="Brugernavn" required="" autofocus="">
<label for="password" class="sr-only">Password</label>
<input type="password" id="password" name="password" class="form-control" placeholder="Password" required="">
<button type="submit" id="login-btn" class="btn btn-lg btn-primary btn-block" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Logger ind...">Login</button>
<div id="error">Login mislykkedes. Kontroller venligst brugernavn og kodeord.</div>
</form>
</div>
</body>
</html>


Tried enabling the "Detect Loop" option?

Visit my Website for links to Cool Solution articles.
0 Likes
ScorpionSting Absent Member.
Absent Member.

Re: FF and Looping

ScorpionSting;2495851 wrote:
Tried enabling the "Detect Loop" option?


I suspect there is something in ./js/login.js that is causing the problem, but if something in the "GUI" is displayed with Detect Loop, that should help. Otherwise, you might need to post the content of the JS

Visit my Website for links to Cool Solution articles.
0 Likes
6525036 Super Contributor.
Super Contributor.

Re: FF and Looping

ScorpionSting;2495852 wrote:
I suspect there is something in ./js/login.js that is causing the problem, but if something in the "GUI" is displayed with Detect Loop, that should help. Otherwise, you might need to post the content of the JS


Loop detection did nothing valuable for it.

But.... the js... here it is.
It would be great to find out what the problem is.

$(function () {

$('#login-btn').on('click', function (event) {
var _this = $(this);
_this.button('loading');
event.preventDefault();
if(localStorage)
localStorage.clear();
$.ajax({
method: 'post',
url: "./control",
data: {cmd: "login", username: $('#username').val(), password: $('#password').val()},
dataType: 'JSON',
cache: false,

success: function (data) {
_this.button('reset');

if (data.result){
if(localStorage){
// Store data
localStorage.setItem("userDN", data.userDN);
}
$(location).attr('href', 'organization.html');
}
else
{
$('#error').show();
$('#password').val('');
}
},
fail : function(data){
$(this).button('reset');
}
});
});
});
0 Likes
ScorpionSting Absent Member.
Absent Member.

Re: FF and Looping

6525036;2495922 wrote:
Loop detection did nothing valuable for it.

But.... the js... here it is.
It would be great to find out what the problem is.

$(function () {

$('#login-btn').on('click', function (event) {
var _this = $(this);
_this.button('loading');
event.preventDefault();
if(localStorage)
localStorage.clear();
$.ajax({
method: 'post',
url: "./control",
data: {cmd: "login", username: $('#username').val(), password: $('#password').val()},
dataType: 'JSON',
cache: false,

success: function (data) {
_this.button('reset');

if (data.result){
if(localStorage){
// Store data
localStorage.setItem("userDN", data.userDN);
}
$(location).attr('href', 'organization.html');
}
else
{
$('#error').show();
$('#password').val('');
}
},
fail : function(data){
$(this).button('reset');
}
});
});
});


Hmmm...might need to log a SR for this one...

What happens from the browser perspective is:



  1. Login page loads
  2. Submit button causes AJAX (JSON) to "/control" for authentication (browser local storage is only used if available - this *may* be causing the problem - if "localstorage" is detected, but because the browser is unaware of the AJAX response as this is handled all within the MAG, the authentication success is not making it to local storage - hence logging SR)
  3. Successful result causes location to organization.html


    I'm guessing the MAG FF is having issues with the way AJAX is actioning in Step 2...

Visit my Website for links to Cool Solution articles.
0 Likes
6525036 Super Contributor.
Super Contributor.

Re: FF and Looping

Thank you.
We might try that.
0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: FF and Looping

On 25-02-2019 10:06 AM, 6525036 wrote:
>


> But.... the js... here it is.
> It would be great to find out what the problem is.
>
>
> Code:
> --------------------
> $(function () {
>
> $('#login-btn').on('click', function (event) {


My 2c....the function doesn't get called as when NAM does the submit its not registered as a 'click' as NAM uses a bit java-script executed by the
browser to auto submit it. Not sure if you have the option to modify this javascript but (no clue if this is valid) change 'click' to 'submit' and see
if that works.



--
Cheers,
Edward
0 Likes
ScorpionSting Absent Member.
Absent Member.

Re: FF and Looping

edmaa;2495935 wrote:
On 25-02-2019 10:06 AM, 6525036 wrote:
>


> But.... the js... here it is.
> It would be great to find out what the problem is.
>
>
> Code:
> --------------------
> $(function () {
>
> $('#login-btn').on('click', function (event) {


My 2c....the function doesn't get called as when NAM does the submit its not registered as a 'click' as NAM uses a bit java-script executed by the
browser to auto submit it. Not sure if you have the option to modify this javascript but (no clue if this is valid) change 'click' to 'submit' and see
if that works.



--
Cheers,
Edward


Missed click-ie....would change actually be captured also? I would suspect this might be more robust:


$('.form-login').on('submit', function (event) {

Visit my Website for links to Cool Solution articles.
0 Likes
6525036 Super Contributor.
Super Contributor.

Re: FF and Looping

ScorpionSting;2495986 wrote:
Missed click-ie....would change actually be captured also? I would suspect this might be more robust:


$('.form-login').on('submit', function (event) {


I was so lucky as to get the developer to recode the authentication for the app.
He spoke something about "reverting to old school methods".
I'm just happy it worked.
0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: FF and Looping

On 03-03-2019 7:24 PM, 6525036 wrote:
>
> ScorpionSting;2495986 Wrote:
>> Missed click-ie....would change actually be captured also? I would
>> suspect this might be more robust:
>>
>>>

> Code:
> --------------------
> > >

> > $('.form-login').on('submit', function (event) {
> >

> --------------------
>>>

>
> I was so lucky as to get the developer to recode the authentication for
> the app.
> He spoke something about "reverting to old school methods".
> I'm just happy it worked.


He probably just eliminated the javascript part 🙂


--
Cheers,
Edward
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.