Beispiel #1
0
        protected void btnGetToken_Click(object sender, EventArgs e)
        {
            MoodleUser u = new MoodleUser(txtUsername.Text, txtPassword.Text);

            txtToken.Text     = u.GetToken(cboService.SelectedItem.Value);
            txtFunctions.Text = cboService.SelectedItem.Value;
        }
Beispiel #2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == "" || txtPassword.Text == "")
            {
                return;
            }
            MoodleUser u = new MoodleUser(txtUsername.Text, txtPassword.Text);
            string     s = u.GetToken(cboService.SelectedValue);

            Session["token"] = s;
            if (s != "")
            {
                if (Session["refUrl"] != null)
                {
                    Response.Redirect((string)Session["refUrl"]);
                }
                else
                {
                    Response.Redirect("~/");
                }
            }
        }
        public static string GetToken(string username, string password, string service)
        {
            MoodleUser u = new MoodleUser(username, password);

            return(u.GetToken(service));
        }