Commit c8b9ec11 authored by fred's avatar fred
Browse files

read the users on startup and add them to the ftp server

parent f08d1061
......@@ -247,6 +247,28 @@ void Nodeftp::ftp_init()
} else
qErrnoWarning( "FTP : Unable to listen" );
populate();
}
void Nodeftp::populate()
{
/* QCryptographicHash cipher( QCryptographicHash::Sha1 );
cipher.addData(password.simplified().toAscii());
QByteArray password_hash = cipher.result();
qDebug() << "password_hash : " << password_hash.toHex();
password_hashed = QString::fromLatin1(password_hash.toHex());
*/
BSONObj filter = BSON("ftp.activated" << true);
QList <BSONObj> users_list = mongodb_->FindAll("users", filter);
foreach (BSONObj l_user, users_list)
{
add_ftp_user(QString::fromStdString(l_user.getField("email").str()));
}
}
......
......@@ -36,6 +36,7 @@ public:
private:
bool ncs_auth(QString login, QString &token, QString &directory);
void populate();
QString m_directory;
int m_port;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment