Skip to content

Commit 6e46952

Browse files
committed
WebUI - Modified the first user object to go into the now included House object by default.
1 parent 3d6c215 commit 6e46952

2 files changed

Lines changed: 57 additions & 57 deletions

File tree

UI/Web/Default.aspx.cs

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
5-
using System.Web.Security;
6-
using System.Web.UI;
7-
using System.Web.UI.WebControls;
8-
9-
using OSAE;
10-
11-
public partial class _Default : System.Web.UI.Page
12-
{
13-
protected void Page_Load(object sender, EventArgs e)
14-
{
15-
if(OSAEObjectManager.GetObjectsByType("PERSON").Count == 0)
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Security;
6+
using System.Web.UI;
7+
using System.Web.UI.WebControls;
8+
9+
using OSAE;
10+
11+
public partial class _Default : System.Web.UI.Page
12+
{
13+
protected void Page_Load(object sender, EventArgs e)
14+
{
15+
if(OSAEObjectManager.GetObjectsByType("PERSON").Count == 0)
1616
Response.Redirect("~/firstrun.aspx");
17-
txtUserName.Focus();
18-
}
19-
20-
protected void imgSubmit_Click(object sender, EventArgs e)
21-
{
22-
OSAEObject obj = OSAEObjectManager.GetObjectByName(txtUserName.Text);
23-
24-
if (obj != null)
25-
{
26-
string pass = obj.Property("Password").Value;
27-
if (pass == txtPassword.Text)
28-
{
29-
// Success, create non-persistent authentication cookie.
30-
FormsAuthentication.SetAuthCookie(
17+
txtUserName.Focus();
18+
}
19+
20+
protected void imgSubmit_Click(object sender, EventArgs e)
21+
{
22+
OSAEObject obj = OSAEObjectManager.GetObjectByName(txtUserName.Text);
23+
24+
if (obj != null)
25+
{
26+
string pass = obj.Property("Password").Value;
27+
if (pass == txtPassword.Text)
28+
{
29+
// Success, create non-persistent authentication cookie.
30+
FormsAuthentication.SetAuthCookie(
3131
this.txtUserName.Text.Trim(), false);
32-
Int32 cto = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue("Web Server", "Timeout").Value);
33-
FormsAuthenticationTicket ticket1 = new FormsAuthenticationTicket(this.txtUserName.Text.Trim(),true,cto);
34-
HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket1));
35-
Response.Cookies.Add(cookie1);
36-
37-
// 4. Do the redirect.
38-
String returnUrl1;
39-
// the login is successful
40-
if (Request.QueryString["ReturnUrl"] == null)
41-
{
42-
returnUrl1 = "objects.aspx";
43-
}
44-
45-
//login not unsuccessful
46-
else
47-
{
48-
returnUrl1 = Request.QueryString["ReturnUrl"];
49-
}
50-
51-
Response.Redirect(returnUrl1);
52-
}
53-
else
54-
lblError.Visible = true;
55-
56-
}
57-
lblError.Visible = true;
58-
}
32+
Int32 cto = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue("Web Server", "Timeout").Value);
33+
FormsAuthenticationTicket ticket1 = new FormsAuthenticationTicket(this.txtUserName.Text.Trim(),true,cto);
34+
HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket1));
35+
Response.Cookies.Add(cookie1);
36+
37+
// 4. Do the redirect.
38+
String returnUrl1;
39+
// the login is successful
40+
if (Request.QueryString["ReturnUrl"] == null)
41+
{
42+
returnUrl1 = "objects.aspx";
43+
}
44+
45+
//login not unsuccessful
46+
else
47+
{
48+
returnUrl1 = Request.QueryString["ReturnUrl"];
49+
}
50+
51+
Response.Redirect(returnUrl1);
52+
}
53+
else
54+
lblError.Visible = true;
55+
56+
}
57+
lblError.Visible = true;
58+
}
5959
}

UI/Web/firstrun.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected void createUserLinkButton_Click(object sender, EventArgs e)
2626
{
2727
if (txtPass.Text == txtPass2.Text)
2828
{
29-
OSAEObjectManager.ObjectAdd(txtUser.Text, "Web UI user", "PERSON", "", "", true);
29+
OSAEObjectManager.ObjectAdd(txtUser.Text, "Web UI user", "PERSON", "", "House", true);
3030
OSAEObjectPropertyManager.ObjectPropertySet(txtUser.Text, "Password", txtPass.Text, "Web UI");
3131
Response.Redirect("~/objects.aspx");
3232
}

0 commit comments

Comments
 (0)