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:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -68,7 +68,8 @@ void Notify::Init()
|
||||
patterns.SetLocale(&TemplatesFunctions::locale);
|
||||
patterns.SetLocaleFilter(&TemplatesFunctions::locale_filter);
|
||||
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
|
||||
notify_template_activate_account = AddTemplate(L"notify_confirm_account.txt");
|
||||
|
||||
plugin.Call(WINIX_NOTIFY_ADD_TEMPLATE);
|
||||
}
|
||||
@@ -89,6 +90,7 @@ void Notify::ItemChanged(int notify_code, const Item & item)
|
||||
if( notify_code == 0 )
|
||||
return;
|
||||
|
||||
msg.Clear();
|
||||
msg.code = notify_code;
|
||||
msg.template_index = notify_template_cms;
|
||||
CreateItemLink(item, msg.item_link, msg.dir_link);
|
||||
@@ -106,6 +108,22 @@ void Notify::ItemChanged(const NotifyMsg & msg)
|
||||
}
|
||||
|
||||
|
||||
void Notify::ActivateAccount(const std::wstring & name, const std::wstring & email, long code)
|
||||
{
|
||||
msg.Clear();
|
||||
msg.code = WINIX_NOTIFY_CODE_CONFIRM_ACCOUNT;
|
||||
msg.name = name;
|
||||
msg.email = email;
|
||||
msg.lang = 0;
|
||||
msg.activate_code = code;
|
||||
msg.template_index = notify_template_activate_account;
|
||||
CreateActivateLink(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)
|
||||
{
|
||||
@@ -118,7 +136,7 @@ size_t Notify::AddTemplate(const std::wstring & file_name)
|
||||
|
||||
void Notify::CreateItemLink(const Item & item, std::wstring & item_link, std::wstring & dir_link)
|
||||
{
|
||||
static std::wstring tmp_path;
|
||||
tmp_path.clear();
|
||||
|
||||
if( item.type == Item::dir )
|
||||
{
|
||||
@@ -141,3 +159,15 @@ static std::wstring tmp_path;
|
||||
|
||||
|
||||
|
||||
void Notify::CreateActivateLink(const std::wstring & name, long code, std::wstring & link)
|
||||
{
|
||||
wchar_t buff[50];
|
||||
|
||||
link = config->url_proto;
|
||||
link += config->base_url;
|
||||
link += L"/pw/activate/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