Commit 59788ab0 authored by Leigh Stoller's avatar Leigh Stoller

Checkpoint a slew of changes to the APT code. New signup page,

start of a page to create new profiles, lots of other changes
and additions.
parent 0b99e74e
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2011, 2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -41,6 +41,7 @@ my $debug = 0;
my $nonlocal= 0;
my $impotent= 0;
my $silent = 0;
my $viaAPT = 0;
my $resend;
#
......@@ -221,6 +222,11 @@ my $xmlparse = eval { XMLin($xmlfile,
fatal($@)
if ($@);
# APT flag. Notice and delete.
if (exists($xmlparse->{'attribute'}->{"viaAPT"})) {
$viaAPT = 1;
delete($xmlparse->{'attribute'}->{"viaAPT"});
}
#
# Make sure all the required arguments were provided.
......@@ -326,8 +332,12 @@ if (exists($newproj_args{'newuser_xml'})) {
print $cmd . "\n"
if ($debug);
my $cmd_out = `$cmd`;
UserError("Transient Error: (3, $?, $cmd) $cmd_out")
if ($?);
if ($?) {
if (($? >> 8) > 0) {
UserError($cmd_out);
}
fatal("Error creating new user: (3, $?, $cmd) $cmd_out");
}
#
# Parse the last line of output. Ick.
......@@ -360,6 +370,9 @@ exit(0)
my $new_pid = $newproj_args{'pid'};
delete($newproj_args{'pid'});
delete($newproj_args{'head_uid'});
# APT flag.
$newproj_args{'viaAPT'} = 1
if ($viaAPT);
my $newproj = Project->Create($new_pid, $leader, \%newproj_args);
if (!defined($newproj)) {
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -41,6 +41,7 @@ my $impotent= 0;
my $type = "";
my $silent = 0;
my $portal = 0;
my $viaAPT = 0;
my @keyfiles = ();
#
......@@ -206,6 +207,20 @@ fatal($@)
print STDERR Dumper($xmlparse)
if ($debug);
# APT flag. Notice and delete.
if (exists($xmlparse->{'attribute'}->{"viaAPT"})) {
$viaAPT = 1;
delete($xmlparse->{'attribute'}->{"viaAPT"});
# Remove these, we do not require them on the APT path.
delete($required{"affiliation_abbreviation"});
delete($required{"phone"});
delete($required{"title"});
delete($required{"address"});
delete($required{"zip"});
delete($required{"wikiname"});
}
#
# Make sure all the required arguments were provided.
#
......@@ -428,6 +443,9 @@ elsif ($type eq "wikionly") {
elsif ($type eq "leader") {
$flags = $User::NEWUSER_FLAGS_PROJLEADER;
}
if ($viaAPT) {
$flags |= $User::NEWUSER_FLAGS_VIAAPT;
}
my $newuser = User->Create($new_uid, $flags, \%newuser_args);
if (!defined($newuser)) {
fatal("Could not create new user!");
......@@ -500,7 +518,7 @@ SENDMAIL("$usr_name '$usr_uid' <$usr_email>",
"Testbed Operations\n",
"$TBAPPROVAL",
"Bcc: $TBAUDIT")
if (!$silent);
if (!($silent || $viaAPT));
#
# Do we have a keyfile? If so, rerun addpubkey for real now that the
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2005-2013 University of Utah and the Flux Group.
# Copyright (c) 2005-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -435,17 +435,17 @@ sub SendNewProjectEmail($;$)
my $leader = $self->GetLeader();
my $usr_uid = $leader->uid();
my $usr_idx = $leader->uid_idx();
my $usr_title = $leader->title();
my $usr_title = $leader->title() || "";
my $usr_name = $leader->name();
my $usr_affil = $leader->affil();
my $usr_email = $leader->email();
my $usr_addr = $leader->addr();
my $usr_addr = $leader->addr() || "";
my $usr_addr2 = $leader->addr2();
my $usr_city = $leader->city();
my $usr_state = $leader->state();
my $usr_zip = $leader->zip();
my $usr_zip = $leader->zip() || "";
my $usr_country = $leader->country();
my $usr_phone = $leader->phone();
my $usr_phone = $leader->phone() || "";
my $usr_URL = $leader->URL();
my $wikiname = $leader->wikiname();
my $returning = $leader->status() ne $User::USERSTATUS_NEWUSER;
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2005-2013 University of Utah and the Flux Group.
# Copyright (c) 2005-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -38,7 +38,7 @@ use File::Basename;
use overload ('""' => 'Stringify');
use vars qw($NEWUSER_FLAGS_PROJLEADER $NEWUSER_FLAGS_WIKIONLY
$NEWUSER_FLAGS_WEBONLY $NEWUSER_FLAGS_ARCHIVED
$NEWUSER_FLAGS_NOUUID $NEWUSER_FLAGS_NONLOCAL
$NEWUSER_FLAGS_NOUUID $NEWUSER_FLAGS_NONLOCAL $NEWUSER_FLAGS_VIAAPT
$USERSTATUS_ACTIVE $USERSTATUS_FROZEN
$USERSTATUS_UNAPPROVED $USERSTATUS_UNVERIFIED
$USERSTATUS_NEWUSER $USERSTATUS_ARCHIVED $USERSTATUS_NONLOCAL
......@@ -66,6 +66,7 @@ $NEWUSER_FLAGS_WEBONLY = 0x04;
$NEWUSER_FLAGS_ARCHIVED = 0x08;
$NEWUSER_FLAGS_NOUUID = 0x80;
$NEWUSER_FLAGS_NONLOCAL = 0x40;
$NEWUSER_FLAGS_VIAAPT = 0x20;
# Status values.
$USERSTATUS_ACTIVE = "active";
......@@ -79,7 +80,7 @@ $USERSTATUS_NONLOCAL = "nonlocal";
# Why, why, why?
@EXPORT_OK = qw($NEWUSER_FLAGS_PROJLEADER $NEWUSER_FLAGS_WIKIONLY
$NEWUSER_FLAGS_WEBONLY $NEWUSER_FLAGS_ARCHIVED
$NEWUSER_FLAGS_NOUUID
$NEWUSER_FLAGS_NOUUID $NEWUSER_FLAGS_VIAAPT
$USERSTATUS_ACTIVE $USERSTATUS_FROZEN
$USERSTATUS_UNAPPROVED $USERSTATUS_UNVERIFIED
$USERSTATUS_NEWUSER $USERSTATUS_ARCHIVED $USERSTATUS_NONLOCAL);
......@@ -394,6 +395,7 @@ sub Create($$$$)
my $archived = ($flags & $NEWUSER_FLAGS_ARCHIVED ? 1 : 0);
my $nonlocal = ($flags & $NEWUSER_FLAGS_NONLOCAL ? 1 : 0);
my $nouuid = ($flags & $NEWUSER_FLAGS_NOUUID ? 1 : 0);
my $viaapt = ($flags & $NEWUSER_FLAGS_VIAAPT ? 1 : 0);
#
# If no uid, we need to generate a unique one for the user.
......@@ -578,6 +580,11 @@ sub Create($$$$)
push(@insert_data, "pswd_expires=now()");
push(@insert_data, "usr_pswd='*'");
}
elsif ($viaapt) {
push(@insert_data, "status='$USERSTATUS_UNAPPROVED'");
push(@insert_data, "pswd_expires=date_add(now(), interval 1 year)");
push(@insert_data, "viaAPT='1'");
}
else {
push(@insert_data, "status='$USERSTATUS_NEWUSER'");
push(@insert_data, "pswd_expires=date_add(now(), interval 1 year)");
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2008-2013 University of Utah and the Flux Group.
# Copyright (c) 2008-2014 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -564,6 +564,32 @@ sub GetKeys($)
return @keys;
}
#
# Get the key bundle for a local user, which are just sshkeys.
# This function is intended to be used only by the SA to get the
# key bundle from the emulab ssh keys for the local user.
#
sub GetKeyBundle($$)
{
my ($self, $pref) = @_;
my @results = ();
return -1
if (! (ref($self) && ref($pref)));
my @tmp = $self->GetKeys();
goto done
if (!@tmp);
foreach my $sshkey (@tmp) {
push(@results, {"type" => 'ssh',
"key" => $sshkey});
}
done:
@$pref = @results;
return 0;
}
#
# Delete sshkeys for a user.
#
......
......@@ -39,15 +39,16 @@ use Data::Dumper;
#
sub usage()
{
print "Usage: quickvm <xmlfile>\n";
print "Usage: quickvm [-l] <xmlfile>\n";
print "Usage: quickvm -k <uuid>\n";
print "Usage: quickvm -e <seconds> <uuid>\n";
exit(1);
}
my $optlist = "dkve:";
my $optlist = "dkve:l";
my $debug = 0;
my $verbose = 1;
my $killit = 0;
my $localuser = 0;;
my $xmlfile;
my $extend;
my $quickuuid;
......@@ -111,6 +112,9 @@ if (defined($options{"d"})) {
if (defined($options{"v"})) {
$verbose = 1;
}
if (defined($options{"l"})) {
$localuser = 1;
}
if (defined($options{"k"})) {
$killit = 1;
}
......@@ -314,8 +318,11 @@ if (exists($xmlparse->{'attribute'}->{"sshkey"}) &&
# have to create an ssl certificate (which the user will never see)
# so that we can operate on behalf of the user (via speaksfor).
#
my $geniuser = GeniUser->Lookup($user_urn, 0);
my $geniuser = GeniUser->Lookup($user_urn, $localuser);
if (!defined($geniuser)) {
if ($localuser) {
fatal("Could not lookup local user $user_urn");
}
#
# Do not allow overlap with local users.
#
......@@ -367,16 +374,15 @@ $geniuser->BumpActivity();
# Remember key. For now we accept only one key. We store it simply
# so we can display it again for the user in the web interface.
# We allow key reuse for existing users, see above.
if (defined($sshkey)) {
if (!$localuser && defined($sshkey)) {
$geniuser->DeleteKeys();
$geniuser->AddKey($sshkey);
}
# There will be "internal" keys ...
my @sshkeys = $geniuser->GetKeys();
if (! @sshkeys) {
my @sshkeys;
if ($geniuser->GetKeyBundle(\@sshkeys) < 0 || !@sshkeys) {
fatal("No ssh keys to use for $geniuser!");
}
@sshkeys = map { "key" => "$_", "type" => "ssh" }, @sshkeys;
#
# Now generate a slice registration and credential
......@@ -604,7 +610,7 @@ sub Terminate($)
}
my $row = $query_result->fetchrow_hashref();
my $geniuser = GeniUser->Lookup($row->{'creator_uuid'}, 0);
my $geniuser = GeniUser->Lookup($row->{'creator_uuid'}, 1);
if (!defined($geniuser)) {
fatal("No creator for quick VM: $uuid");
}
......@@ -677,7 +683,7 @@ sub Extend($$)
}
my $row = $query_result->fetchrow_hashref();
my $geniuser = GeniUser->Lookup($row->{'creator_uuid'}, 0);
my $geniuser = GeniUser->Lookup($row->{'creator_uuid'}, 1);
if (!defined($geniuser)) {
fatal("No creator for quick VM: $uuid");
}
......
......@@ -3649,6 +3649,7 @@ CREATE TABLE `projects` (
`nonlocal_id` varchar(128) default NULL,
`nonlocal_type` tinytext,
`manager_urn` varchar(128) default NULL,
`viaAPT` tinyint(1) default '0',
PRIMARY KEY (`pid_idx`),
UNIQUE KEY `pid` (`pid`),
KEY `unix_gid` (`unix_gid`),
......@@ -4399,6 +4400,7 @@ CREATE TABLE `users` (
`default_project` mediumint(8) unsigned default NULL,
`nocollabtools` tinyint(1) default '0',
`initial_passphrase` varchar(128) default NULL,
`viaAPT` tinyint(1) default '0',
PRIMARY KEY (`uid_idx`),
KEY `unix_uid` (`unix_uid`),
KEY `status` (`status`),
......
#
# Add viaAPT to users and projects.
#
use strict;
use libdb;
my $impotent = 0;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("users", "viaAPT")) {
DBQueryFatal("alter table users add ".
" `viaAPT` tinyint(1) default '0'");
}
if (!DBSlotExists("projects", "viaAPT")) {
DBQueryFatal("alter table projects add ".
" `viaAPT` tinyint(1) default '0'");
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -149,12 +149,15 @@ BLOBFILES += $(wildcard blob/*.php3)
APTUIFILES = $(wildcard $(SRCDIR)/aptui/*.php)
APTUIFILES += $(wildcard $(SRCDIR)/aptui/*.css)
APTUIFILES += $(wildcard $(SRCDIR)/aptui/*.png)
APTUIFILES += $(wildcard $(SRCDIR)/aptui/.htaccess)
APTJSFILES = $(wildcard $(SRCDIR)/aptui/js/*.js)
APTLIBFILES = $(wildcard $(SRCDIR)/aptui/js/lib/*.js)
UIKITFILES = $(wildcard $(SRCDIR)/aptui/uikit/fonts/*)
BOOTSTFONTS = $(wildcard $(SRCDIR)/aptui/bootstrap/fonts/*)
BOOTSTCSS = $(wildcard $(SRCDIR)/aptui/bootstrap/css/*)
BOOTSTJS = $(wildcard $(SRCDIR)/aptui/bootstrap/js/*)
HELPERSCSS = $(wildcard $(SRCDIR)/aptui/formhelpers/css/*)
HELPERSJS = $(wildcard $(SRCDIR)/aptui/formhelpers/js/*)
# need to make it *.gz; with simply "*",
# we end up sucking over "CVS"
......@@ -219,6 +222,8 @@ ALLUIKITFONTS = $(notdir $(UIKITFILES))
ALLBOOTSTFONTS = $(notdir $(BOOTSTFONTS))
ALLBOOTSTCSS = $(notdir $(BOOTSTCSS))
ALLBOOTSTJS = $(notdir $(BOOTSTJS))
ALLHELPCSS = $(notdir $(HELPERSCSS))
ALLHELPJS = $(notdir $(HELPERSJS))
INSTALLFILES = $(addprefix $(INSTALL_SBINDIR)/, htmlinstall) \
$(addprefix $(INSTALL_WWWDIR)/, $(ALLFILES)) \
......@@ -265,7 +270,9 @@ apt-install: $(addprefix $(INSTALL_WWWDIR)/apt/, $(ALLAPTUI)) \
$(addprefix $(INSTALL_WWWDIR)/apt/js/lib/, $(ALLAPTLIB)) \
$(addprefix $(INSTALL_WWWDIR)/apt/bootstrap/css/, $(ALLBOOTSTCSS)) \
$(addprefix $(INSTALL_WWWDIR)/apt/bootstrap/js/, $(ALLBOOTSTJS)) \
$(addprefix $(INSTALL_WWWDIR)/apt/bootstrap/fonts/, $(ALLBOOTSTFONTS))
$(addprefix $(INSTALL_WWWDIR)/apt/bootstrap/fonts/, $(ALLBOOTSTFONTS)) \
$(addprefix $(INSTALL_WWWDIR)/apt/formhelpers/css/, $(ALLHELPCSS)) \
$(addprefix $(INSTALL_WWWDIR)/apt/formhelpers/js/, $(ALLHELPJS))
post-install:
......
#ErrorDocument 404 /error.php
#ErrorDocument 403 /error.php
<?php
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
chdir("..");
include("defs.php3");
include_once("geni_defs.php");
chdir("apt");
include("quickvm_sup.php");
$dblink = GetDBLink("sa");
#
# Get current user.
#
$this_user = CheckLogin($check_status);
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("create", PAGEARG_STRING);
#
# Spit the form
#
function SPITFORM()
{
SPITHEADER(1);
SPITFOOTER();
}
#
# If not clicked, then put up a form.
#
if (! isset($create)) {
SPITFORM();
return;
}
?>
<?php
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
chdir("..");
include("defs.php3");
chdir("apt");
include("quickvm_sup.php");
# No page arguments, but make sure that the environment is clean
RequiredPageArguments();
SPITHEADER();
echo "The URL you gave: <b>" . htmlentities( $_SERVER["REQUEST_URI"] ) . "</b>
is not available or is broken.";
SPITFOOTER();
......@@ -83,7 +83,10 @@
this.$element.html('');
if (this.options.blank === true) {
if (this.options.ask === true) {
this.$element.append('<option value="">Please Select Country</option>');
}
else if (this.options.blank === true) {
this.$element.append('<option value=""></option>');
}
......@@ -174,7 +177,8 @@
country: '',
available: '',
flags: false,
blank: true
blank: true,
ask: false
};
......
......@@ -72,7 +72,10 @@
this.$element.html('');
if (this.options.blank === true) {
if (this.options.ask === true) {
this.$element.append('<option value="">Please Select State</option>');
}
else if (this.options.blank === true) {
this.$element.append('<option value=""></option>');
}
......@@ -213,7 +216,8 @@
$.fn.bfhstates.defaults = {
country: '',
state: '',
blank: true
blank: true,
ask: false
};
......
......@@ -14201,7 +14201,10 @@ var BFHTimezonesList = {
this.$element.html('');
if (this.options.blank === true) {
if (this.options.ask === true) {
this.$element.append('<option value="">Please Select Country</option>');
}
else if (this.options.blank === true) {
this.$element.append('<option value=""></option>');
}
......@@ -14292,7 +14295,8 @@ var BFHTimezonesList = {
country: '',
available: '',
flags: false,
blank: true
blank: true,
ask: false
};
......@@ -17140,7 +17144,10 @@ var BFHTimezonesList = {
this.$element.html('');
if (this.options.blank === true) {
if (this.options.ask === true) {
this.$element.append('<option value="">Please Select State</option>');
}
else if (this.options.blank === true) {
this.$element.append('<option value=""></option>');
}
......@@ -17281,7 +17288,8 @@ var BFHTimezonesList = {
$.fn.bfhstates.defaults = {
country: '',
state: '',
blank: true
blank: true,
ask: false
};
......
......@@ -4,7 +4,7 @@ require.config({
'jquery': 'js/lib/jquery-2.0.3.min',
'bootstrap': 'bootstrap/js/bootstrap',
'dateformat': 'js/lib/date.format',
'd3': 'js/lib/d3.v3'
'd3': 'js/lib/d3.v3',
},
shim: {
'bootstrap': { deps: ['jquery'] },
......@@ -14,6 +14,7 @@ require.config({
});
require(['jquery', 'js/quickvm_sup',
'formhelpers/js/bootstrap-formhelpers',
// jQuery modules
'bootstrap'],
function ($, sup)
......@@ -22,18 +23,19 @@ function ($, sup)
function initialize()
{
var pageType = 'index';
var pageType = 'donotsetthistoindex';
if (window.APT_OPTIONS)
{
console.log('APT_OPTIONS: ' + JSON.stringify(window.APT_OPTIONS));
if (window.APT_OPTIONS.isNewUser)
{
sup.ShowModal('#working');
sup.ShowModal('#verify_modal');
}
if (window.APT_OPTIONS.pageType)
{
pageType = window.APT_OPTIONS.pageType;
}
initLoginButton();
}
else
{
......@@ -54,7 +56,32 @@ function ($, sup)
window.APT_OPTIONS.sliceExpires);
initStatusButtons();
}
else if (pageType == 'signup') {
$('button#reset-form').click(function (event) {
event.preventDefault();
sup.resetForm($('#quickvm_signup_form'));
});
if (window.APT_OPTIONS.ShowVerifyModal)
{
sup.ShowModal('#verify_modal');
}
}
else if (pageType == 'manage_profile') {
try {
$('#rspecfile').change(function() {
var reader = new FileReader();
reader.onload = function(event) {
var content = event.target.result;
sup.ShowUploadedRspec(content);
};
reader.readAsText(this.files[0]);
});
}
catch (e) {
alert(e);
}
}
$('body').show();
}
......@@ -110,6 +137,13 @@ function ($, sup)
sup.Terminate(window.APT_OPTIONS.uuid, 'quickvm.php');
});
}
function initLoginButton()
{
$('#quickvm_login_modal_button').click(function (event) {
event.preventDefault();
sup.LoginByModal();
});
}
$(document).ready(initialize);
});
......@@ -130,7 +130,7 @@ function ShowTopo(uuid)
console.info(topo);
$("#showtopo_container").removeClass("invisible");
maketopmap("#topo-container",
maketopmap("#showtopo_container",
$("#showtopo_div").width() - 30,
300, topo);
......@@ -345,7 +345,7 @@ function Extend(uuid)
function RegisterAccount(uid, email)
{
HideModal('#register_modal');
var url = "../newproject.php3?uid=" + uid + "&email=" + email + "";
var url = "signup.php?uid=" + uid + "&email=" + email + "";
var win = window.open(url, '_blank');
win.focus();
}
......@@ -387,7 +387,7 @@ function InitQuickVM(uuid, slice_expires)
}
function resetForm($form) {
$form.find('input:text, select, textarea').val('');
$form.find('input:text, input:password, select, textarea').val('');
}
function StartSSH(id, authobject)
......@@ -919,6 +919,62 @@ function ConvertManifestToJSON(name, xml)
return json;
}
function ShowUploadedRspec(content)
{
var xmlDoc = $.parseXML(content);
var xml = $(xmlDoc);
var topo = ConvertManifestToJSON(null, xml);
console.info(topo);
ShowModal("#quickvm_topomodal");
maketopmap("#showtopo_div",
($("#showtopo_dialog").outerWidth()) - 90,
300, topo);
}
/*
* Try to log the user in via an ajax call.
*/
function LoginByModal()
{
var uid = $("#quickvm_login_form [name='uid']").val();
var password = $("#quickvm_login_form [name='password']").val();
// Clear previous error.
$("#quickvm_login_form_error").html("");
var callback = function(json) {
if (json.code) {
$("#quickvm_login_form_error").html("Login failed. Try again?");
}
else {
// Clear previous error.
$("#quickvm_login_form_error").html("");
HideModal("#quickvm_login_modal");
$("#loginbutton").html(uid + " logged in");
}
}
var xmlthing = $.ajax({
// the URL for the request
url: "login.php",
// the data to send (will be converted to a query string)
data: {
ajax_request: 1,