Пример #1
0
        void VerifyPassword(Player p, string message)
        {
            if (!p.adminpen)
            {
                p.Message("%WYou are already verified."); return;
            }
            if (p.passtries >= 3)
            {
                p.Kick("Did you really think you could keep on guessing?"); return;
            }

            if (message.IndexOf(' ') >= 0)
            {
                p.Message("Your password must be %Wone %Sword!"); return;
            }
            if (!PasswordHasher.Exists(p.name))
            {
                p.Message("You have not %Wset a password, %Suse %T/SetPass [Password] %Wto set one!"); return;
            }

            if (PasswordHasher.MatchesPass(p.name, message))
            {
                p.Message("You are now &averified %Sand have &aaccess to admin commands and features.");
                p.adminpen = false;
            }
            else
            {
                p.passtries++;
                p.Message("%WWrong Password. %SRemember your password is %Wcase sensitive.");
                p.Message("Forgot your password? %SContact the owner so they can reset it.");
            }
        }
Пример #2
0
        void SetPassword(Player p, string message)
        {
            if (p.adminpen && PasswordHasher.Exists(p.name))
            {
                p.Message("%WcYou already have a password set. %SYou %Wcannot change %Sit unless %Wyou verify it with &a/pass [Password]. " +
                          "%SIf you have %Wforgotten %Syour password, contact %W" + ServerConfig.OwnerName + " %Sand they can %Wreset it!");
                return;
            }
            if (message.IndexOf(' ') >= 0)
            {
                p.Message("Your password must be one word!"); return;
            }

            PasswordHasher.StoreHash(p.name, message);
            p.Message("Your password has &asuccessfully &abeen set to:");
            p.Message("&c" + message);
        }