fixed: misc: ValidateEmail() buffer overflow
added: notifications for resetting a user's password (there is no a winix function for this yet) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@817 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -17,16 +17,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Notify::Notify()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Notify::SetCur(Cur * pcur)
|
||||
{
|
||||
cur = pcur;
|
||||
@@ -70,6 +65,7 @@ void Notify::Init()
|
||||
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
|
||||
notify_template_activate_account = AddTemplate(L"notify_confirm_account.txt");
|
||||
notify_template_reset_password = AddTemplate(L"notify_reset_password.txt");
|
||||
|
||||
plugin.Call(WINIX_NOTIFY_ADD_TEMPLATE);
|
||||
}
|
||||
@@ -124,6 +120,21 @@ void Notify::ActivateAccount(const std::wstring & name, const std::wstring & ema
|
||||
}
|
||||
|
||||
|
||||
void Notify::ResetPassword(const std::wstring & name, const std::wstring & email, long code)
|
||||
{
|
||||
msg.Clear();
|
||||
msg.code = WINIX_NOTIFY_CODE_RESET_PASSWORD;
|
||||
msg.name = name;
|
||||
msg.email = email;
|
||||
msg.lang = 0; // !! IMPROVE ME a better language can be chose
|
||||
msg.activate_code = code;
|
||||
msg.template_index = notify_template_reset_password;
|
||||
CreateResetPasswordLink(name, code, msg.item_link);
|
||||
|
||||
notify_pool.Add(msg);
|
||||
notify_thread.WakeUpThread(); // we are in the first locked thread
|
||||
}
|
||||
|
||||
|
||||
size_t Notify::AddTemplate(const std::wstring & file_name)
|
||||
{
|
||||
@@ -171,3 +182,16 @@ wchar_t buff[50];
|
||||
Toa(code, buff, sizeof(buff)/sizeof(wchar_t));
|
||||
link += buff;
|
||||
}
|
||||
|
||||
void Notify::CreateResetPasswordLink(const std::wstring & name, long code, std::wstring & link)
|
||||
{
|
||||
wchar_t buff[50];
|
||||
|
||||
link = config->url_proto;
|
||||
link += config->base_url;
|
||||
link += L"/pw/resetpassword/login:";
|
||||
UrlEncode(name, link, false);
|
||||
link += L"/code:";
|
||||
Toa(code, buff, sizeof(buff)/sizeof(wchar_t));
|
||||
link += buff;
|
||||
}
|
||||
|
Reference in New Issue
Block a user