Exemplo n.º 1
0
        //conctes to server to validate new user.
        //return string of confirmation code
        private Boolean checkUserName(String email, String password)
        {
            Boolean confirmed = false;
            const string CONFIRMED = "confirmed";

            User user = LocalData.getUserProperties();

            if (String.Compare(email, user.Email) == 0)
            {
                if (String.Compare(password, user.Password) == 0)
                {
                    //TODO earse after eran will change
                    //user.SecurityCode = CONFIRMED;
                    if (String.Compare(CONFIRMED, user.SecurityCode) != 0)
                    {
                        confirmation confirmation = new confirmation();
                        this.Hide();
                        confirmation.Show();
                    }
                    else
                    {
                        confirmed = true;
                    }
                }
            }
            //TODO
            //return true;
            return confirmed;
        }
Exemplo n.º 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            error.Visible = false;
            //check params
            if (password.Text != reEnterPassword.Text)
            {
                password.Text = null;
                reEnterPassword.Text = null;
                error.Text = PASSWORD_DOESNT_MACH;
                error.Visible = true;
                return;
            }
            if (name.Text == "" || email.Text == "" ||
                password.Text == "" || reEnterPassword.Text == "")
            {
                error.Text = PARAM_MISSING;
                error.Visible = true;
                return;
            }
            if ( ! validEmail(email.Text, password.Text) )
            {
                error.Text = EMAIL_NOT_REGEX;
                error.Visible = true;
                return;
            }

            //try to sign newUser
            String userId = newUserName(email.Text, password.Text);
            if ( userId == null )
            {
                error.Text = EMAIL_NOT_VALID;
                error.Visible = true;
                return;
            }

            //set new values in user's properties table.
            Boolean success = setProperties(name.Text, email.Text,
                password.Text, userId);
            if (success)
            {

            }
            else
            {
                //return;
            }
            confirmation confirmation = new confirmation();
            this.Hide();
            confirmation.Show();
        }