Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 27th October 2009, 17:22
giftsnake giftsnake is offline
Senior Member
 
Join Date: Jan 2009
Posts: 108
Thanks: 15
Thanked 9 Times in 8 Posts
Default embedd login form into website

hi, i am trying to include the login of ispconfig3 into a website. my guess was:

Quote:
<form method="post" action="https://my.domain.com:8080/index.php" target="_blank">
<input type="hidden" name ="_action" value="login" />
<fieldset>
<legend>
ispconfig Login
</legend>
<input class="input_user" type="text" name="_user" onblur="if(this.value=='')this.value='Benutzer';" onfocus="if(this.value=='Benutzer')this.value='';" value="Benutzer" /><br />
<input class="input_pass" type="password" name="_pass" onblur="if(this.value=='')this.value='Kennwort';" onfocus="if(this.value=='Kennwort')this.value='';" value="Kennwort" /><br />
<input class="input_submit" type="submit" name="input_submit" value="Login" />
</fieldset>
</form>
it did not work (obviously, otherwise i would not post it here )
if someone has a working form, please post it here!
Thanks in advance, giftsnake
Reply With Quote
Sponsored Links
  #2  
Old 4th November 2009, 15:58
giftsnake giftsnake is offline
Senior Member
 
Join Date: Jan 2009
Posts: 108
Thanks: 15
Thanked 9 Times in 8 Posts
Default

hm, maybe i posted in the wrong forum :-/
Reply With Quote
  #3  
Old 5th November 2009, 15:32
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

What happens when you submit the form?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 5th November 2009, 15:58
giftsnake giftsnake is offline
Senior Member
 
Join Date: Jan 2009
Posts: 108
Thanks: 15
Thanked 9 Times in 8 Posts
Default

same as if i call the interface in the browser. the username and the password does not do anything

Last edited by giftsnake; 5th November 2009 at 16:02.
Reply With Quote
  #5  
Old 9th November 2009, 13:10
giftsnake giftsnake is offline
Senior Member
 
Join Date: Jan 2009
Posts: 108
Thanks: 15
Thanked 9 Times in 8 Posts
Default

Quote:
//* Login Form was send
if(count($_POST) > 0) {

//** Check variables
if(!preg_match("/^[\w\.\-\_]{1,64}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
if(!preg_match("/^.{1,64}$/i", $_POST['passwort'])) $error = $app->lng('pw_error_length');

//** iporting variables
$ip = $app->db->quote(ip2long($_SERVER['REMOTE_ADDR']));
$username = $app->db->quote($_POST['username']);
$passwort = $app->db->quote($_POST['passwort']);
-> changed the variables in the submit-form to 'username' and 'passwort'
what happens:
the login button calls the index.php page with:
Code:
https://domain.com:8080/index.php?username=myusername&passwort=mysecretpassword
i still get no login. any ideas?
Reply With Quote
  #6  
Old 9th November 2009, 14:00
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,997
Thanks: 840
Thanked 5,650 Times in 4,460 Posts
Default

The login form works with ajax, you can not use a external login form in ispconfig 3 withour rewriting the ispconfig login mechanism.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 26th November 2009, 08:20
briansmith briansmith is offline
Junior Member
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I am currently working on my thesis which involves a custom toolbar. This toolbar is activated once the user successfully logs in his/her gmail account. Basically very similar to the code you provided however, if its successfull it does not re-direct to one's email but displays a message that you have successfully logged in. If not successfull, it does not re-direct you to the gmail homepage but just lets you re-enter one's credentials. In addition how can I have another button which when clicked will log out?
__________________
r4i칩
Reply With Quote
  #8  
Old 22nd October 2014, 18:35
LKTechnik LKTechnik is offline
Junior Member
 
Join Date: Oct 2014
Posts: 6
Thanks: 0
Thanked 2 Times in 1 Post
Default

HTML Code:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js"></script>

<form name="ajaxform" id="ajaxform"  method="POST"  >
    <input type="hidden" name="s_mod" value="login">
    <input type="hidden" name="s_pg" value="index">
    <input name="username" id="username" value="" size="30" maxlength="255" type="text">
    <input name="passwort" id="passwort" value="" size="30" maxlength="255" type="password">
    <button type="submit" class="button" value=""  ><span>Anmelden</span></button>
</form>

<script type="text/javascript">
    //callback handler for form submit
    $("#ajaxform").submit(function()
    {
        var postData = $(this).serializeArray();
        $.ajax({
            url : 'https://isp.tld:8080/content.php',
            type: "POST",
            data : postData,
            xhrFields: {withCredentials: true},
            success:function(){
                window.location.replace("https://isp.tld:8080/index.php");
            }
        });
        return false;
    });
</script>
/usr/local/ispconfig/lib/config.inc.local.php
PHP Code:
<?php
    header
('Access-Control-Allow-Origin: http://www.lktechnik.ch');
    
header('Access-Control-Allow-Methods: POST');
    
header('Access-Control-Allow-Credentials: true');
Reply With Quote
The Following 2 Users Say Thank You to LKTechnik For This Useful Post:
theWeird (29th October 2014), webguyz (2nd November 2014)
  #9  
Old 2nd November 2014, 23:05
webguyz webguyz is offline
Senior Member
 
Join Date: Oct 2012
Location: Earth
Posts: 144
Thanks: 38
Thanked 18 Times in 15 Posts
Default

LKTechnik,

Thanks for the login form for which works well. One thing I'm trying to do is have my customer login in once into my WHMCS billing system and I would automate logging in to my customers various cp's like cPanel, WebsitePanel, Helm, etc.

With your form I can add some post variables and hide the username and password fields which I populated with my POST. Customer has to just hit the submit button and they are automaticaly logged into ISPconfig.

Was wondering if it would be possible to auto submit the form after it has the variables, something I do with other cp's that I autolog into.

I tried this on your form but it seems to be stuck in a loop:

<SCRIPT LANGUAGE="JavaScript">
document.ajaxform.submit();
</SCRIPT>

Maybe a limitation of ajax, but it would be cool if its possible. If not just being able to autofill the form and present the end users a single button to hit is excellent. I know others have been looking for something like this for a long time.

Thanks!
Reply With Quote
  #10  
Old 3rd November 2014, 20:21
LKTechnik LKTechnik is offline
Junior Member
 
Join Date: Oct 2014
Posts: 6
Thanks: 0
Thanked 2 Times in 1 Post
Default

yes its possible, and its easy...

PHP Code:
<?php
echo '<div class="borderbox" style="text-align:center;"><br />Einen Moment bitte Sie werden weitergeleitet...<br /><br />
<img src="'
.$system['url_img'].'ajax-loader.gif" alt="Bitte warten"><br /><br />
</div>


<script type="text/javascript">

function weiterleitung() {
    $.ajax({
    type: "post",
    url: "https://isp.tld:8080/content.php",
    data: "s_mod=login&s_pg=index&username=USERNAME&passwort=PASSWORD",
    xhrFields: {withCredentials: true}
    }).done(function(){location.href=\'https://isp.tld:8080/index.php\'});

}
window.setTimeout("weiterleitung()", 100);


</script>

'
;
Change
https://isp.tld:8080
USERNAME
PASSWORD

to your data / Users data
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ispconfig 3 cant receive emails lishaw1968 Installation/Configuration 25 19th August 2013 11:37
Webmail problems with only one domain? compner Installation/Configuration 14 16th February 2010 17:59
Postfix can't received email from exterior astra2000 Server Operation 5 18th October 2009 00:26
Centos 5.2 + ISPConfig 3 tutorial - Problem with email tanakskool Server Operation 1 3rd June 2009 17:22
Unable to authenticate to SMTP server ashkev Installation/Configuration 15 6th February 2007 18:46


All times are GMT +2. The time now is 16:52.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.