Page 1 of 1

costum login

PostPosted: Tue Mar 15, 2016 7:18 pm
by akaphilippeassemien
hello, i'm new user of Servoy developer

i need help te realise a solution like this:

-in the solution users must login with a user name and a password
-for a firs connexion he need to redefine his password
-the password expire each 3 mouth

i create a table named 'authentification' with 4 colums (id, nom_user, pass_user, exp_date)
i create my Login solution named 'login2'

function loginUser(event) {
var correct = true;
var echec=null;
if (!scopes.globals.userName) {
echec = 'Please specify a user name';
correct = false;
}
if (!scopes.globals.password) {
echec = 'Please specify a password';
correct = false;
}

if (correct) {
if (!security.authenticate("authentification", [scopes.globals.userName, scopes.globals.password])) {
echec = "No tenant found. Please check your password";
correct = false;
}
}
echec = 'Login Failed';
return correct;
}

i create also an authentification solution named 'loginAuth'

function loginU(user , password) {
var result = false;
if (! (user && password)) {
application.output('données de connexion incorecte', LOGGINGLEVEL.DEBUG);
result = false;
}

var _query = 'SELECT *\
FROM authentification\
WHERE nom_user=?\
AND pass_user=?'
var dataset = databaseManager.getDataSetByQuery("example_data","authentification", _query, [user, password], 1);

if (dataset.getMaxRowIndex() == 1) {
result = true;
}
return result;
}

i want to know if i need te create login form in this solution with connexion button while i ceate it in login solution?

what i did is to create a login form with connexion button but i dont put function in onClick i create simply a function name'loginU(user , password)'

when i lauch i get this error message:
"invalid foundset set in form authentification1
> java.lang.IllegalArgumentException: Impossible de définir le foundset depuis la table NONE avec un formulaire utilisant la table authentification
"
Help please.