namespace Devoid { using Devoid.Properties; using Devoid.Sessions; using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; public class frmLogin : Form { private GroupBox boxLogin; private Button cmdLogin; private IContainer components = null; private Label lblLogin; private Label lblPassword; private Label lblUrl; private Label lblUsername; private TextBox txtPassword; private TextBox txtUrl; private TextBox txtUsername; public frmLogin() { this.InitializeComponent(); } private void cmdLogin_Click(object sender, EventArgs e) { this.cmdLogin.Enabled = false; this.cmdLogin.Text = "Busy..."; string text = this.txtUrl.Text; string username = this.txtUsername.Text; string password = this.txtPassword.Text; if ((username == "") || (password == "")) { Engine.Interface.showMessageBox("Please do not leave any fields blank.", "Devoid : Login error", MessageBoxIcon.Exclamation); } else if ((text == "") || (text.IndexOf("http://") != 0)) { Engine.Interface.showMessageBox("Please fill in a valid link to the root of the target site, starting with http:// and no trailing slashes etc. (eg, http://www.google.com)", "Devoid : login error", MessageBoxIcon.Exclamation); } else { Engine.Site.sSiteUrl = text; if (Engine.DEBUG_ENABLED) { Engine.Log("Set site URL, URL=" + Engine.Site.sSiteUrl); } try { userSession trackerSession = Engine.Site.LogUserIn(username, password); if (((trackerSession != null) && Engine.Site.SetClientDetails(trackerSession)) && Engine.Site.SetSsoTicketForSessionUser(trackerSession)) { Engine.Sessions.trackerSession = trackerSession; if (Engine.Site.writeClientFile()) { Engine.Interface.showMessageBox("Successfully logged user '" + username + "' in, client will now initialize, check your default internet browser.", "Devoid : login OK!", MessageBoxIcon.Asterisk); Engine.Connections.openTrackerListener(); Process.Start(Application.StartupPath + @"\client.htm"); base.Close(); Engine.Interface.mainForm.setTools(); return; } } Engine.Site.sSiteUrl = ""; if (Engine.DEBUG_ENABLED) { Engine.Log("Unset site URL"); } Engine.Interface.showMessageBox("Failed to log user '" + username + "' in at " + text + "/index.php?do=process_login, verify that this is a HoloCMS server and that your credentials are correct.", "Devoid : login error", MessageBoxIcon.Exclamation); } catch (Exception exception) { Engine.Interface.showMessageBox("Unhandled exception upon logging in!\r\nException: " + exception.Message + "\r\nStacktrace: " + exception.StackTrace, "Devoid : login error", MessageBoxIcon.Exclamation); } } this.cmdLogin.Enabled = true; this.cmdLogin.Text = "Log in"; } protected override void Dispose(bool disposing) { if (disposing && (this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); } private void frmLogin_FormClosing(object sender, FormClosingEventArgs e) { } private void frmLogin_Load(object sender, EventArgs e) { } private void InitializeComponent() { ComponentResourceManager manager = new ComponentResourceManager(typeof(frmLogin)); this.txtUrl = new TextBox(); this.txtPassword = new TextBox(); this.txtUsername = new TextBox(); this.lblUsername = new Label(); this.lblPassword = new Label(); this.lblUrl = new Label(); this.boxLogin = new GroupBox(); this.cmdLogin = new Button(); this.lblLogin = new Label(); this.boxLogin.SuspendLayout(); base.SuspendLayout(); this.txtUrl.Location = new Point(0x41, 0x15); this.txtUrl.Name = "txtUrl"; this.txtUrl.Size = new Size(0x12e, 20); this.txtUrl.TabIndex = 0; this.txtUrl.Text = "http://holobeta.ho.funpic.de"; this.txtPassword.Location = new Point(0x41, 0x4a); this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; this.txtPassword.Size = new Size(0x12e, 20); this.txtPassword.TabIndex = 1; this.txtPassword.Text = "test123"; this.txtUsername.Location = new Point(0x41, 0x30); this.txtUsername.Name = "txtUsername"; this.txtUsername.Size = new Size(0x12e, 20); this.txtUsername.TabIndex = 2; this.txtUsername.Text = "Nillus"; this.lblUsername.AutoSize = true; this.lblUsername.Location = new Point(3, 0x33); this.lblUsername.Name = "lblUsername"; this.lblUsername.Size = new Size(0x3a, 13); this.lblUsername.TabIndex = 3; this.lblUsername.Text = "Username:"; this.lblPassword.AutoSize = true; this.lblPassword.Location = new Point(3, 0x4d); this.lblPassword.Name = "lblPassword"; this.lblPassword.Size = new Size(0x38, 13); this.lblPassword.TabIndex = 4; this.lblPassword.Text = "Password:"; this.lblUrl.AutoSize = true; this.lblUrl.Location = new Point(3, 0x18); this.lblUrl.Name = "lblUrl"; this.lblUrl.Size = new Size(0x35, 13); this.lblUrl.TabIndex = 5; this.lblUrl.Text = "Site URL:"; this.boxLogin.Controls.Add(this.cmdLogin); this.boxLogin.Controls.Add(this.lblUrl); this.boxLogin.Controls.Add(this.lblPassword); this.boxLogin.Controls.Add(this.lblUsername); this.boxLogin.Controls.Add(this.txtUsername); this.boxLogin.Controls.Add(this.txtPassword); this.boxLogin.Controls.Add(this.txtUrl); this.boxLogin.Location = new Point(14, 0x2d); this.boxLogin.Name = "boxLogin"; this.boxLogin.Size = new Size(0x175, 0x85); this.boxLogin.TabIndex = 0; this.boxLogin.TabStop = false; this.boxLogin.Text = "Login details"; this.cmdLogin.FlatStyle = FlatStyle.Flat; this.cmdLogin.Image = Resources.building_go; this.cmdLogin.ImageAlign = ContentAlignment.MiddleLeft; this.cmdLogin.Location = new Point(6, 0x62); this.cmdLogin.Name = "cmdLogin"; this.cmdLogin.Size = new Size(0x169, 30); this.cmdLogin.TabIndex = 6; this.cmdLogin.Text = "Log in"; this.cmdLogin.UseVisualStyleBackColor = true; this.cmdLogin.Click += new EventHandler(this.cmdLogin_Click); this.lblLogin.Font = new Font("Microsoft Sans Serif", 26.25f, FontStyle.Bold, GraphicsUnit.Point, 0); this.lblLogin.Location = new Point(11, 6); this.lblLogin.Name = "lblLogin"; this.lblLogin.Size = new Size(0x179, 0x27); this.lblLogin.TabIndex = 1; this.lblLogin.Text = "Login"; this.lblLogin.TextAlign = ContentAlignment.MiddleCenter; base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x18f, 0xbb); base.Controls.Add(this.lblLogin); base.Controls.Add(this.boxLogin); base.Icon = (Icon) manager.GetObject("$this.Icon"); base.MaximizeBox = false; base.MinimizeBox = false; base.Name = "frmLogin"; this.Text = "Devoid : login"; base.Load += new EventHandler(this.frmLogin_Load); base.FormClosing += new FormClosingEventHandler(this.frmLogin_FormClosing); this.boxLogin.ResumeLayout(false); this.boxLogin.PerformLayout(); base.ResumeLayout(false); } } }