added: a new winix function: passwd
for changing your password or if you are a super user you can change a password for anyone added: uname prints available plugins now git-svn-id: svn://ttmath.org/publicrep/winix/trunk@748 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
35
db/db.cpp
35
db/db.cpp
@@ -114,6 +114,31 @@ 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)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.user set(password, pass_encrypted,"
|
||||
"pass_type, pass_hash_salted) = (");
|
||||
|
||||
// for safety
|
||||
if( password_encrypted.empty() )
|
||||
query << password;
|
||||
else
|
||||
query << "";
|
||||
|
||||
query.EPutBin(password_encrypted);
|
||||
|
||||
query << pass_type
|
||||
<< pass_hash_salted
|
||||
<< R(") where login=")
|
||||
<< login
|
||||
<< R(";");
|
||||
|
||||
return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -633,7 +658,7 @@ Error Db::EditSortIndexItemById(long id, int sort_index)
|
||||
|
||||
|
||||
|
||||
PGresult * Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel)
|
||||
void Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel)
|
||||
{
|
||||
query << R("select item.id, content_id");
|
||||
|
||||
@@ -659,7 +684,7 @@ PGresult * Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query,
|
||||
}
|
||||
|
||||
|
||||
PGresult * Db::GetItemsQueryJoin(const DbItemQuery & iq, DbTextStream & query)
|
||||
void Db::GetItemsQueryJoin(const DbItemQuery & iq, DbTextStream & query)
|
||||
{
|
||||
if( iq.sel_content || iq.sel_file || iq.where_file_type )
|
||||
query << R(" left join core.content on item.content_id = content.id");
|
||||
@@ -667,7 +692,7 @@ PGresult * Db::GetItemsQueryJoin(const DbItemQuery & iq, DbTextStream & query)
|
||||
|
||||
|
||||
|
||||
PGresult * Db::GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query)
|
||||
void Db::GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query)
|
||||
{
|
||||
if( iq.where_id || iq.where_parent_id || iq.where_type || iq.where_file_type )
|
||||
{
|
||||
@@ -716,7 +741,7 @@ PGresult * Db::GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query)
|
||||
}
|
||||
|
||||
|
||||
PGresult * Db::GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query)
|
||||
void Db::GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query)
|
||||
{
|
||||
if( iq.sel_sort_index || iq.sel_date )
|
||||
{
|
||||
@@ -741,7 +766,7 @@ PGresult * Db::GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query)
|
||||
}
|
||||
|
||||
|
||||
PGresult * Db::GetItemsQueryLimit(const DbItemQuery & iq, DbTextStream & query)
|
||||
void Db::GetItemsQueryLimit(const DbItemQuery & iq, DbTextStream & query)
|
||||
{
|
||||
if( iq.limit != 0 )
|
||||
query << R(" limit ") << iq.limit;
|
||||
|
Reference in New Issue
Block a user