Patch level : 10.0 294

Files correlati     : ba1.exe ba1400a.msk
Ricompilazione Demo : [ ]
Commento            :
0001288: data scadenza password dell'utente
verificato che pur inserendo la PasswordEXpiration in studio.ini e cambiando la password non si visualizzano i dati riguardanti la scadenza password.


git-svn-id: svn://10.65.10.50/trunk@18793 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-04-28 15:33:53 +00:00
parent 5cc2b97eea
commit 4686a9ba52
2 changed files with 43 additions and 32 deletions

View File

@ -1,7 +1,6 @@
#include <colors.h>
#include <modaut.h>
#include <msksheet.h>
#include <prefix.h>
#include <relapp.h>
#include <utility.h>
#include <tree.h>
@ -449,8 +448,7 @@ bool TSet_user_passwd::password_handler(TMask_field& f, KEY key)
if (ok)
{
TConfig ini(CONFIG_STUDIO, "Main");
const int minlen = ini.get_int("MinPwdLen", NULL, -1, 4);
const int minlen = ini_get_int(CONFIG_STUDIO, "Main", "MinPwdLen", 4);
if (pwdlen < minlen)
{
TString msg; msg.format(TR("La password deve essere lunga almeno %d caratteri."), minlen);
@ -692,17 +690,13 @@ bool TSet_users::user_create()
int TSet_users::read(TMask& m)
{
TRelation_application::read(m);
const TRectype& r = get_relation()->curr();
build_sheet(&r);
const char* pwd = decode(r.get(USR_PASSWORD));
m.set(F_PASSWORD, pwd);
m.set(F_PROVA, pwd);
build_tree(&r);
return NOERR;
const int err = TSet_user_passwd::read(m);
if (err == NOERR)
{
const TRectype& r = get_relation()->curr();
build_tree(&r);
}
return err;
}
void TSet_user_passwd::put_in_record(const TMask& m)
@ -713,7 +707,11 @@ void TSet_user_passwd::put_in_record(const TMask& m)
{
r.put(USR_PASSWORD, s);
if (r.exist(USR_DATAPWD))
r.put(USR_DATAPWD, TDate(TODAY));
{
const TDate oggi(TODAY);
((TMask&)m).set(F_DATAPWD, oggi);
r.put(USR_DATAPWD, oggi);
}
}
}
@ -767,14 +765,15 @@ int TSet_user_passwd::rewrite(const TMask& m)
bool TSet_users::remove()
{
const TString16 u = get_relation()->curr().get(USR_USERNAME);
const bool ok = TRelation_application::remove();
if (ok)
if (ok && u.full())
{
TFilename file = firm2dir(-1); // Directory dati
file.add("config"); // Directory configurazioni
file.add(get_relation()->curr().get(USR_USERNAME)); // Nome utente
file.add(u); // Nome utente
file.ext("ini"); // Estensione
::remove(file);
file.fremove();
}
return ok;
}
@ -798,15 +797,28 @@ bool TSet_users::user_destroy()
int TSet_user_passwd::read(TMask& m)
{
TRelation_application::read(m);
const TRectype& r = get_relation()->curr();
build_sheet(&r);
const char* pwd = decode(r.get(USR_PASSWORD));
m.set(F_PASSWORD, pwd);
m.set(F_PROVA, pwd);
return NOERR;
const int err = TRelation_application::read(m);
if (err == NOERR)
{
const TRectype& r = get_relation()->curr();
build_sheet(&r);
const char* pwd = decode(r.get(USR_PASSWORD));
m.set(F_PASSWORD, pwd);
m.set(F_PROVA, pwd);
const int pe = ini_get_int(CONFIG_STUDIO, "Main", "PasswordExpiration");
if (pe > 0)
{
TDate data(m.get(F_DATAPWD));
if (data.ok())
{
data += pe;
m.set(F_DATASCAD, data);
}
}
}
return err;
}
void TSet_user_passwd::init_query_mode(TMask& m)
@ -830,16 +842,15 @@ void TSet_user_passwd::init_modify_mode(TMask& m)
int ba1400(int argc, char** argv)
{
const char* const title = TR("Configurazione utenti");
if (user() == ::dongle().administrator())
{
TSet_users a;
a.run(argc, argv, title);
a.run(argc, argv, TR("Configurazione utenti"));
}
else
{
TSet_user_passwd a;
a.run(argc, argv, title);
a.run(argc, argv, TR("Configurazione utente"));
}
return 0;
}

View File

@ -4,7 +4,7 @@ TOOLBAR "" 0 0 0 2
#include <relapbar.h>
ENDPAGE
PAGE "Gestione utenti" -1 -1 35 7
PAGE "Gestione utenti" 0 2 0 0
GROUPBOX DLG_NULL 78 5
BEGIN
@ -108,7 +108,7 @@ END
ENDPAGE
PAGE "Permessi" -1 -1 78 20
PAGE "Permessi" 0 2 0 0
TREE F_PERMESSI -3 -8
BEGIN