Esempio n. 1
0
        public void Login()
        {
            if (username == "")
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Please enter a username"), true);
#else
                ShowDialog("Please enter a username", true);
#endif
                return;
            }
            if (loginclick > Time.time)
            {
                return;
            }
            loginclick = Time.time + 1f;

            //ShowDialog("Logging In...", false);
            Dictionary <string, object> props = new Dictionary <string, object>();

            /*props.Add("stringprop", "hi");
            *  props.Add("intprop", 5);
            *  props.Add("boolprop", true);
            *  props.Add("floatprop", -0.3f);*/
            if (AtavismSettings.Instance.GetGeneralSettings().saveCredential)
            {
                AtavismSettings.Instance.GetCredentials().l = username;
                AtavismSettings.Instance.GetCredentials().p = password;
            }
            if (useMd5Encryption)
            {
                AtavismClient.Instance.Login(username, AtavismEncryption.Md5Sum(password), props);
            }
            else
            {
                AtavismClient.Instance.Login(username, password, props);
            }
        }
Esempio n. 2
0
        public void Register()
        {
            if (regUsername == "")
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Please enter a username"), true);
#else
                ShowDialog("Please enter a username", true);
#endif
                return;
            }
            if (regUsername.Length < 4)
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Your username must be at least 4 characters long"), true);
#else
                ShowDialog("Your username must be at least 4 characters long", true);
#endif
                return;
            }
            foreach (char chr in regUsername)
            {
                if ((chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z') && (chr < '0' || chr > '9'))
                {
#if AT_I2LOC_PRESET
                    ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Your username can only contain letters and numbers"), true);
#else
                    ShowDialog("Your username can only contain letters and numbers", true);
#endif
                    return;
                }
            }
            if (regPassword == "")
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Please enter a password"), true);
#else
                ShowDialog("Please enter a password", true);
#endif
                return;
            }
            foreach (char chr in regPassword)
            {
                if (chr == '*' || chr == '\'' || chr == '"' || chr == '/' || chr == '\\' || chr == ' ')
                {
#if AT_I2LOC_PRESET
                    ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Your password cannot contain * \' \" / \\ or spaces"), true);
#else
                    ShowDialog("Your password cannot contain * \' \" / \\ or spaces", true);
#endif
                    return;
                }
            }
            if (regPassword.Length < 6)
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Your password must be at least 6 characters long"), true);
#else
                ShowDialog("Your password must be at least 6 characters long", true);
#endif
                return;
            }
            if (regPassword != password2)
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Your passwords must match"), true);
#else
                ShowDialog("Your passwords must match", true);
#endif
                return;
            }
            if (email == "")
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Please enter an email address"), true);
#else
                ShowDialog("Please enter an email address", true);
#endif
                return;
            }
            if (!ValidateEmail(email))
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Please enter a valid email address"), true);
#else
                ShowDialog("Please enter a valid email address", true);
#endif
                return;
            }
            if (email != email2)
            {
#if AT_I2LOC_PRESET
                ShowDialog(I2.Loc.LocalizationManager.GetTranslation("Your email addresses must match"), true);
#else
                ShowDialog("Your email addresses must match", true);
#endif
                return;
            }
            if (useMd5Encryption)
            {
                AtavismClient.Instance.CreateAccount(regUsername, AtavismEncryption.Md5Sum(regPassword), email);
            }
            else
            {
                AtavismClient.Instance.CreateAccount(regUsername, regPassword, email);
            }
        }