Core/Account: Make account password change security variable and various changes

Settings within worldserver.conf:

Three settings for secruity level:
0 - None - No change to current system
1 - Email - Always requires the email entered on registration for confirming.
2 - RBAC - Groups applied with the RBAC role always require the email entered on registration for confirming.

RBAC default to every group. Changed some logs to make it more clear what is going on at all.

Emails may now no longer exceed 64 chars. Current email is used as regmail.

On account creation, two emails are saved. Registration email and normal email. Normal email is relevant afterwards. Registration email can be changed by console ONLY.

Includes new commands and changes to existing ones:
.account fulfills several new functions:
* Still prints GM Level.
* If account has permission, it displays the current email. This is not defaulted to any group.
* Security level is displayed. Also displays if user has RBAC perm if RBAC security mode is selected
.account email allows user to change email with sufficient confirmation
.account set sec email allows higher sec with higher sec than account to change the normal email. Registrationemail remains untouched here.
.account set sec regmail allows console to change registration email.
.pinfo now displays the registration and normal mail.

Also fixes .learn all crafts.
Closes #10558
This commit is contained in:
Ascathor committed 2013-09-01 21:21:16 +02:00
1 parent 79d1b7f543
commit 722a6c143a
16 files changed
+612 -68

No files matched your search

+33 -27
View File
@@ -1520,20 +1520,21 @@ public:
* ** Muted: (Time, Reason, By) - IV. LANG_PINFO_MUTED (if muted)
* * Account: %s (id: %u), GM Level: %u - V. LANG_PINFO_ACC_ACCOUNT
* * Last Login: %u (Failed Logins: %u) - VI. LANG_PINFO_ACC_LASTLOGIN
* * Uses OS: %s - Latency: %u ms - Email %s - VII. LANG_PINFO_ACC_OS
* * Last IP: %u (Locked: %s) - VIII. LANG_PINFO_ACC_IP
* * Level: %u (%u/%u XP (%u XP left) - IX. LANG_PINFO_CHR_LEVEL
* * Race: %s %s, Class %s - X. LANG_PINFO_CHR_RACE
* * Alive ?: %s - XI. LANG_PINFO_CHR_ALIVE
* * Phase: %s - XII. LANG_PINFO_CHR_PHASE (if not GM)
* * Money: %ug%us%uc - XIII. LANG_PINFO_CHR_MONEY
* * Map: %s, Area: %s - XIV. LANG_PINFO_CHR_MAP
* * Guild: %s (Id: %u) - XV. LANG_PINFO_CHR_GUILD (if in guild)
* ** Rank: %s - XVI. LANG_PINFO_CHR_GUILD_RANK (if in guild)
* ** Note: %s - XVII. LANG_PINFO_CHR_GUILD_NOTE (if in guild and has note)
* ** O. Note: %s - XVIII.LANG_PINFO_CHR_GUILD_ONOTE (if in guild and has officer note)
* * Played time: %s - XIX. LANG_PINFO_CHR_PLAYEDTIME
* * Mails: %u Read/%u Total - XX. LANG_PINFO_CHR_MAILS (if has mails)
* * Uses OS: %s - Latency: %u ms - VII. LANG_PINFO_ACC_OS
* * Registration Email: %s - Email: %s - VIII. LANG_PINFO_ACC_REGMAILS
* * Last IP: %u (Locked: %s) - IX. LANG_PINFO_ACC_IP
* * Level: %u (%u/%u XP (%u XP left) - X. LANG_PINFO_CHR_LEVEL
* * Race: %s %s, Class %s - XI. LANG_PINFO_CHR_RACE
* * Alive ?: %s - XII. LANG_PINFO_CHR_ALIVE
* * Phase: %s - XIII. LANG_PINFO_CHR_PHASE (if not GM)
* * Money: %ug%us%uc - XIV. LANG_PINFO_CHR_MONEY
* * Map: %s, Area: %s - XV. LANG_PINFO_CHR_MAP
* * Guild: %s (Id: %u) - XVI. LANG_PINFO_CHR_GUILD (if in guild)
* ** Rank: %s - XVII. LANG_PINFO_CHR_GUILD_RANK (if in guild)
* ** Note: %s - XVIII.LANG_PINFO_CHR_GUILD_NOTE (if in guild and has note)
* ** O. Note: %s - XVIX. LANG_PINFO_CHR_GUILD_ONOTE (if in guild and has officer note)
* * Played time: %s - XX. LANG_PINFO_CHR_PLAYEDTIME
* * Mails: %u Read/%u Total - XXI. LANG_PINFO_CHR_MAILS (if has mails)
*
* Not all of them can be moved to the top. These should
* place the most important ones to the head, though.
@@ -1546,6 +1547,7 @@ public:
uint32 accId = 0;
uint32 lowguid = GUID_LOPART(targetGuid);
std::string eMail = handler->GetTrinityString(LANG_ERROR);
std::string regMail = handler->GetTrinityString(LANG_ERROR);
uint32 security = 0;
std::string lastIp = handler->GetTrinityString(LANG_ERROR);
uint8 locked = 0;
@@ -1666,8 +1668,9 @@ public:
(!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)))
{
eMail = fields[2].GetString();
lastIp = fields[3].GetString();
lastLogin = fields[4].GetString();
regMail = fields[3].GetString();
lastIp = fields[4].GetString();
lastLogin = fields[5].GetString();
uint32 ip = inet_addr(lastIp.c_str());
EndianConvertReverse(ip);
@@ -1689,12 +1692,12 @@ public:
lastIp = "Unauthorized";
lastLogin = "Unauthorized";
}
muteTime = fields[5].GetUInt64();
muteReason = fields[6].GetString();
muteBy = fields[7].GetString();
failedLogins = fields[8].GetUInt32();
locked = fields[9].GetUInt8();
OS = fields[10].GetString();
muteTime = fields[6].GetUInt64();
muteReason = fields[7].GetString();
muteBy = fields[8].GetString();
failedLogins = fields[9].GetUInt32();
locked = fields[10].GetUInt8();
OS = fields[11].GetString();
}
// Creates a chat link to the character. Returns nameLink
@@ -1783,8 +1786,11 @@ public:
// Output VI. LANG_PINFO_ACC_LASTLOGIN
handler->PSendSysMessage(LANG_PINFO_ACC_LASTLOGIN, lastLogin.c_str(), failedLogins);
// Output VIII. LANG_PINFO_ACC_OS
handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS.c_str(), latency, eMail.c_str());
// Output VII. LANG_PINFO_ACC_OS
handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS.c_str(), latency);
// Output VIII. LANG_PINFO_ACC_REGMAILS
handler->PSendSysMessage(LANG_PINFO_ACC_REGMAILS, regMail.c_str(), eMail.c_str());
// Output IX. LANG_PINFO_ACC_IP
handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked ? "Yes" : "No");
@@ -1828,7 +1834,7 @@ public:
if (target)
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : "<Unknown>"), (!areaName.empty() ? areaName.c_str() : "<Unknown>"));
// Output XVII. - XX. if they are not empty
// Output XVII. - XVIX. if they are not empty
if (!guildName.empty())
{
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId);
@@ -1839,7 +1845,7 @@ public:
handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str());
}
// Output XXI. LANG_PINFO_CHR_PLAYEDTIME
// Output XX. LANG_PINFO_CHR_PLAYEDTIME
handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, true, true)).c_str());
// Mail Data - an own query, because it may or may not be useful.
@@ -1861,7 +1867,7 @@ public:
// ... we have to convert it from Char to int. We can use totalmail as it is
rmailint = atol(readmail.c_str());
// Output XXII. LANG_INFO_CHR_MAILS if at least one mail is given
// Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given
if (totalmail >= 1)
handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, rmailint, totalmail);
}