summaryrefslogtreecommitdiffstats
path: root/projecttemplates/MvcRelyingParty/Setup.aspx.cs
diff options
context:
space:
mode:
Diffstat (limited to 'projecttemplates/MvcRelyingParty/Setup.aspx.cs')
-rw-r--r--projecttemplates/MvcRelyingParty/Setup.aspx.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/projecttemplates/MvcRelyingParty/Setup.aspx.cs b/projecttemplates/MvcRelyingParty/Setup.aspx.cs
new file mode 100644
index 0000000..633496f
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Setup.aspx.cs
@@ -0,0 +1,39 @@
+namespace MvcRelyingParty {
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.IO;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.RelyingParty;
+ using RelyingPartyLogic;
+
+ public partial class Setup : System.Web.UI.Page {
+ private bool databaseCreated;
+
+ protected void Page_Load(object sender, EventArgs e) {
+ if (!Page.IsPostBack) {
+ this.openidLogin.Focus();
+ }
+ }
+
+ protected void openidLogin_LoggingIn(object sender, OpenIdEventArgs e) {
+ // We don't actually want to log in... we just want the claimed identifier.
+ e.Cancel = true;
+ if (e.IsDirectedIdentity) {
+ this.noOPIdentifierLabel.Visible = true;
+ } else if (!this.databaseCreated) {
+ Utilities.CreateDatabase(e.ClaimedIdentifier, this.openidLogin.Text, "MvcRelyingParty");
+ this.MultiView1.ActiveViewIndex = 1;
+
+ // indicate we have already created the database so that if the
+ // identifier the user gave has multiple service endpoints,
+ // we won't try to recreate the database as the next one is considered.
+ this.databaseCreated = true;
+ }
+ }
+ }
+}