jakeh
09-09-2004, 01:07 PM
I have a authentication method that gets login name and password and checks it against an xml file to see if it matches. This works fine and returns bad authentication if the login matches and the pass is wrong, but if the login doesnt exist it just sits there. Anyone have a suggestion?
<datapointer id="mypointer" xpath="authdata:/">
<method name="findNode" args="login,pass">
Debug.write( "Authenticating user... " + login );
this.setAttribute( "login", login );
this.setAttribute( "pass" , pass );
return this.authenticator();
</method>
<method name="authenticator">
do {
if ( this.xpathQuery("@login")==this.login ) {
Debug.write( "-------------- USER LOCATED" );
debug.write("ROLE:" + this.xpathQuery("@role"));
var myrole = this.xpathQuery("@role");
var match = this.xpathQuery("@pass");
if( match == this.pass){
debug.write("Authenticated");
loginwindow.setVisible(false);
if (myrole == "res"){
resstate.apply();
}
else { managementstate.apply(); }
this.setXpath("authdata:/");
}
else{
debug.write("Authentication Failed")
this.setXpath("authdata:/");
}
return this;
}
if ( this.selectChild() ) {
this.authenticator();
}
} while( this.selectNext() );
return null;
</method>
</datapointer>
<datapointer id="mypointer" xpath="authdata:/">
<method name="findNode" args="login,pass">
Debug.write( "Authenticating user... " + login );
this.setAttribute( "login", login );
this.setAttribute( "pass" , pass );
return this.authenticator();
</method>
<method name="authenticator">
do {
if ( this.xpathQuery("@login")==this.login ) {
Debug.write( "-------------- USER LOCATED" );
debug.write("ROLE:" + this.xpathQuery("@role"));
var myrole = this.xpathQuery("@role");
var match = this.xpathQuery("@pass");
if( match == this.pass){
debug.write("Authenticated");
loginwindow.setVisible(false);
if (myrole == "res"){
resstate.apply();
}
else { managementstate.apply(); }
this.setXpath("authdata:/");
}
else{
debug.write("Authentication Failed")
this.setXpath("authdata:/");
}
return this;
}
if ( this.selectChild() ) {
this.authenticator();
}
} while( this.selectNext() );
return null;
</method>
</datapointer>