Add URL in AuthChoice, to post form on another vhost (#291)

This commit is contained in:
Clément Oudot 2013-10-11 09:01:54 +00:00
parent e14824c57f
commit 58912e335c
5 changed files with 17 additions and 7 deletions

View File

@ -1406,7 +1406,7 @@ function authChoiceRoot(id){
function newChoiceR(){ function newChoiceR(){
var newIdValue=newId(currentId); var newIdValue=newId(currentId);
simpleTreeCollection[0].addNode(newIdValue,text4newKey,function(d,s){ simpleTreeCollection[0].addNode(newIdValue,text4newKey,function(d,s){
$('>span',s).attr('onClick','authChoice("'+newIdValue+'")').attr('name',text4newKey).attr('value','Null|Null|Null').attr('id','text_'+newIdValue); $('>span',s).attr('onClick','authChoice("'+newIdValue+'")').attr('name',text4newKey).attr('value','Null|Null|Null|').attr('id','text_'+newIdValue);
authChoice(newIdValue); authChoice(newIdValue);
}); });
return false; return false;
@ -1414,7 +1414,7 @@ function newChoiceR(){
function newChoice(){ function newChoice(){
var newIdValue=newId(currentId); var newIdValue=newId(currentId);
simpleTreeCollection[0].newNodeAfter(newIdValue,text4newKey,function(d,s){ simpleTreeCollection[0].newNodeAfter(newIdValue,text4newKey,function(d,s){
$('>span',s).attr('onClick','authChoice("'+newIdValue+'")').attr('name',text4newKey).attr('value','Null|Null|Null').attr('id','text_'+newIdValue); $('>span',s).attr('onClick','authChoice("'+newIdValue+'")').attr('name',text4newKey).attr('value','Null|Null|Null|').attr('id','text_'+newIdValue);
authChoice(newIdValue); authChoice(newIdValue);
}); });
return false; return false;
@ -1429,6 +1429,7 @@ function authChoice(id){
formateSelectAuth('authChoiceAuth',t[0]); formateSelectAuth('authChoiceAuth',t[0]);
formateSelectUser('authChoiceUser',t[1]); formateSelectUser('authChoiceUser',t[1]);
formateSelectPassword('authChoicePassword',t[2]); formateSelectPassword('authChoicePassword',t[2]);
$('#authChoiceURL').attr('value',t[3]);
display('authChoice',lmtext(id)); display('authChoice',lmtext(id));
$('#newchoice,#delchoice').show(); $('#newchoice,#delchoice').show();
} }
@ -1437,8 +1438,9 @@ function setlmauthchoice(id){
var auth=$('#authChoiceAuth').attr('value'); var auth=$('#authChoiceAuth').attr('value');
var user=$('#authChoiceUser').attr('value'); var user=$('#authChoiceUser').attr('value');
var password=$('#authChoicePassword').attr('value'); var password=$('#authChoicePassword').attr('value');
var url=$('#authChoiceURL').attr('value');
setlmtext(id,key); setlmtext(id,key);
setlmdata(id,auth+'|'+user+'|'+password); setlmdata(id,auth+'|'+user+'|'+password+'|'+url);
} }
/* Application list */ /* Application list */

View File

@ -577,6 +577,10 @@
<td><lang en="Password module" fr="Module de mots de passe"/></td> <td><lang en="Password module" fr="Module de mots de passe"/></td>
<td><select id="authChoicePassword"></select></td> <td><select id="authChoicePassword"></select></td>
</tr> </tr>
<tr>
<td><lang en="URL" fr="URL"/></td>
<td><input type="text" id="authChoiceURL" /></td>
</tr>
</table> </table>
<br /> <br />
<button onclick="setlmauthchoice(currentId);return false;" > <button onclick="setlmauthchoice(currentId);return false;" >

View File

@ -37,7 +37,7 @@
<div id="<TMPL_VAR NAME="key">"> <div id="<TMPL_VAR NAME="key">">
<form action="#" method="post" class="login"> <form action="<TMPL_VAR NAME="url">" method="post" class="login">
<!-- Hidden fields --> <!-- Hidden fields -->
<TMPL_VAR NAME="HIDDEN_INPUTS"> <TMPL_VAR NAME="HIDDEN_INPUTS">

View File

@ -24,7 +24,7 @@
<div id="<TMPL_VAR NAME="key">"> <div id="<TMPL_VAR NAME="key">">
<form action="#" method="post" class="login"> <form action="<TMPL_VAR NAME="url">" method="post" class="login">
<!-- Hidden fields --> <!-- Hidden fields -->
<TMPL_VAR NAME="HIDDEN_INPUTS"> <TMPL_VAR NAME="HIDDEN_INPUTS">

View File

@ -181,13 +181,17 @@ sub _buildAuthLoop {
$name =~ s/\_/ /g; $name =~ s/\_/ /g;
# Find modules associated to authChoice # Find modules associated to authChoice
my ( $auth, $userDB, $passwordDB ) = my ( $auth, $userDB, $passwordDB, $url ) =
split( /\|/, $self->{authChoiceModules}->{$_} ); split( /\|/, $self->{authChoiceModules}->{$_} );
if ( $auth and $userDB and $passwordDB ) { if ( $auth and $userDB and $passwordDB ) {
# Default URL
$url ||= "#";
# Options to store in the loop # Options to store in the loop
my $optionsLoop = { name => $name, key => $_, module => $auth }; my $optionsLoop =
{ name => $name, key => $_, module => $auth, url => $url };
# Get displayType for this module # Get displayType for this module
my $modulePrefix = 'Lemonldap::NG::Portal::'; my $modulePrefix = 'Lemonldap::NG::Portal::';