added: to IsWhite (core/misc)

other unicode white characters
       25 characters -- without a new line character (10)
added: config option: account_need_email_verification
       if true then when creating an account a user has to provide
       his email address and a message with an activation link will be sent 
       back to him
added: 'pw' winix function (not finished yet)
       at the moment only one parameter 'activate'



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@810 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-02-28 21:09:44 +00:00
parent 9208b15167
commit 0e9f587591
45 changed files with 1489 additions and 946 deletions

View File

@@ -77,7 +77,7 @@ Error Db::AddUser(User & user, const UserPass & up)
{
query.Clear();
query << R("insert into core.user (login, password, pass_encrypted, super_user, email,"
"notify, pass_type, pass_hash_salted, env, aenv) values (")
"notify, pass_type, pass_hash_salted, env, aenv, status) values (")
<< user.name;
// for safety we put up.pass only if there is not an encrypted version
@@ -96,6 +96,7 @@ Error Db::AddUser(User & user, const UserPass & up)
<< up.pass_hash_salted
<< user.env
<< user.aenv
<< user.status
<< R(");");
r = AssertQuery(query);
@@ -116,24 +117,22 @@ return status;
Error Db::ChangePass(const std::wstring & login,
const std::wstring & password, const std::string & password_encrypted,
int pass_type, bool pass_hash_salted)
Error Db::ChangeUserPass(const std::wstring & login, const UserPass & up)
{
query.Clear();
query << R("update core.user set(password, pass_encrypted,"
"pass_type, pass_hash_salted) = (");
// for safety
if( password_encrypted.empty() )
query << password;
if( up.pass_encrypted.empty() )
query << up.pass;
else
query << "";
query.EPutBin(password_encrypted);
query.EPutBin(up.pass_encrypted);
query << pass_type
<< pass_hash_salted
query << up.pass_type
<< up.pass_hash_salted
<< R(") where login=")
<< login
<< R(";");
@@ -168,6 +167,19 @@ return DoCommand(query);
}
Error Db::ChangeUserStatus(long user_id, int status)
{
query.Clear();
query << R("update core.user set(status) = (")
<< status
<< R(") where id = ")
<< user_id
<< R(";");
return DoCommand(query);
}
//!! wywalic z nazwy 'Subject' nic nie jest robione z tytulem
// ta metoda uzywana tez jest w EditParentUrlById()
bool Db::AddItemCreateUrlSubject(Item & item)
@@ -1528,7 +1540,7 @@ void Db::GetUsers(UGContainer<User> & user_tab)
try
{
query.Clear();
query << R("select id, login, super_user, group_id, email, notify, env, aenv"
query << R("select id, login, super_user, group_id, email, notify, env, aenv, status"
" from core.user left outer join core.group_mem on"
" core.user.id = core.group_mem.user_id order by id asc;");
@@ -1545,6 +1557,7 @@ void Db::GetUsers(UGContainer<User> & user_tab)
int cnotify = AssertColumn(r, "notify");
int cenv = AssertColumn(r, "env");
int caenv = AssertColumn(r, "aenv");
int cstatus = AssertColumn(r, "status");
User u;
long last_id = -1;
@@ -1560,6 +1573,7 @@ void Db::GetUsers(UGContainer<User> & user_tab)
u.super_user = AssertValueBool(r, i, csuper_user);
u.email = AssertValueWide(r, i, cemail);
u.notify = AssertValueInt(r, i, cnotify);
u.status = AssertValueInt(r, i, cstatus);
AssertValueSpace(r, i, cenv, u.env);
AssertValueSpace(r, i, caenv, u.aenv);

View File

@@ -44,13 +44,12 @@ public:
}
bool GetUserPass(const std::wstring & login, long & user_id, UserPass & up);
bool GetUserPass(const std::wstring & login, long & user_id, UserPass & up);
Error AddUser(User & user, const UserPass & up);
// !! change name to: ChangeUserPass ?
Error ChangePass(const std::wstring & login, const std::wstring & password, const std::string & password_encrypted, int pass_type, bool pass_hash_salted);
Error ChangeUserPass(const std::wstring & login, const UserPass & up);
Error ChangeUserEnv(long user_id, const PT::Space & space);
Error ChangeUserAdminEnv(long user_id, const PT::Space & space);
Error ChangeUserStatus(long user_id, int status);
Error AddItem(Item & item);
Error EditItemById(Item & item, bool with_url = true);