コード例 #1
0
    public void resetpeida()
    {
        green.enabled       = false;
        orange.enabled      = false;
        red.enabled         = false;
        redverify.enabled   = false;
        Passtextverify.text = "";
        Passtext.text       = "";
        Password.text       = "";
        CURRENTPASS.text    = "";
        CURRENTPASS1.text   = "";
        EmailText.text      = "";
        TWRINOSPASS1.text   = "";
        TWRINOSPASS.text    = "";
        Email.text          = "";
        errorPassconfir     = false;
        errorPasscur        = false;
        errorPass           = false;
        Emailalreadyused    = false;
        errorMail           = false;

        if (ColorUtility.TryParseHtmlString("#635E5E", out color))
        {
            Passwordverify.GetComponent <Image>().color = color;
            Password.GetComponent <Image>().color       = color;
            TWRINOSPASS.GetComponent <Image>().color    = color;
            TWRINOSPASS1.GetComponent <Image>().color   = color;
            Email.GetComponent <Image>().color          = color;
        }
    }
コード例 #2
0
    public void changepassnow()
    {
        if (File.Exists(path))
        {
            System.IO.StreamReader file = new System.IO.StreamReader(path);
            count = 0;
            file.ReadLine();
            while ((line = file.ReadLine()) != null)
            {
                count   = count + 1;
                linecol = line.Split(',');
                if (linecol[0] == usernamelog)
                {
                    break;
                }
            }

            file.Close();
        }
        if (TWRINOSPASS.text != linecol[1])
        {
            CURRENTPASS.text = "Ο Τρέχων κωδικός δεν είναι σωστός";
            errorPasscur     = false;
            TWRINOSPASS.GetComponent <Image>().color = Color.red;
        }
        else
        {
            CURRENTPASS.text = " ";
            errorPasscur     = true;
            TWRINOSPASS.GetComponent <Image>().color = Color.green;
        }
        if (Password.text == "")
        {
            Passtext.text = "Ο νέος κωδικός απαιτείται";

            Password.GetComponent <Image>().color = Color.red;
            errorPass      = false;
            Passtext.color = Color.red;
            red.enabled    = false;
            orange.enabled = false;
            green.enabled  = false;
        }

        if (Passwordverify.text == "")
        {
            Passtextverify.text = "Ο κωδικός επιβεβαίωσης απαιτείται";
            Passwordverify.GetComponent <Image>().color = Color.red;
            Passtextverify.color = Color.red;
            redverify.enabled    = false;
        }
        if (errorPass && errorPassconfir && errorPasscur)
        {
            string[] lines = File.ReadAllLines(path);
            using (StreamWriter save = File.CreateText(path))
            {
                save.WriteLine("UserName" + "," + "Password" + "," + "Email");
                for (int currentLine = 1; currentLine < lines.Length; ++currentLine)
                {
                    if (currentLine == count)
                    {
                        linecol = lines[count].Split(',');
                        save.WriteLine(linecol[0] + "," + Password.text + "," + linecol[2]);
                    }
                    else
                    {
                        save.WriteLine(lines[currentLine]);
                    }
                }
            }
            changepasswindow.SetActive(false);
            edit1.text = "Ο κωδικός ενημερώθηκε ";
            edit2.text = "O κωδικός πρόσβασής σας έχει αλλάξει με επιτυχία";
            succesfull.SetActive(true);
        }
    }