/// <summary> /// Initializes a new instance of the <see cref="AuthorizationPage"/> class. /// </summary> /// <param name="returnToUri">The return to URI.</param> /// <param name="appInfo">The application information.</param> public AuthorizationPage( Uri returnToUri, ApplicationInfo appInfo) { this.Title = "secret-co.de: STS - Login"; this.Head.Add(new Html.Link { Href = "../styles/site.css", Rel = "stylesheet" }); this.Body.Add(Header); var content = new Html.Div { @Class = "content", Elements = { new Html.H2 { Elements = { new Html.EncodedText("Authorize Application: "), new Html.EncodedText(appInfo.FriendlyName) } }, new Html.P { Elements = { new Html.EncodedText("Click Authorize to grant the application access to the following information in your account:") } }, new Html.Ul { Items = { new Html.Li { Elements = { new Html.EncodedText("Basic Info - Name, Email Address.") } } } } } }; var form = new Html.Form { Method = "POST", Action = "./authorize", Elements = { new Html.Input { Type = "hidden", Name = "return_to", Value = returnToUri.ToString(), }, new Html.Input { Type = "hidden", Name = "application_name", Value = appInfo.Name.ToString() }, new Html.Input { Type = "submit", Name = "authorize", Value = "Authorize" }, new Html.Input { Type = "submit", Name = "cancel", Value = "Cancel" } } }; content.Elements.Add(form); this.Body.Add(content); }
/// <summary> /// Initializes a new instance of the <see cref="LoginPage" /> class. /// </summary> /// <param name="redirectUri">The redirect URI.</param> /// <param name="errorMessage">The error message.</param> public LoginPage( Uri redirectUri, string errorMessage) { this.Title = "secret-co.de: STS - Login"; this.Head.Add(new Html.Link { Href = "../styles/site.css", Rel = "stylesheet" }); this.Body.Add(Header); var content = new Html.Div { @Class = "content" }; this.Body.Add(content); content.Elements.Add( new Html.H2 { Elements = { new Html.EncodedText("Login") } }); if (!string.IsNullOrEmpty(errorMessage)) { var errorDiv = new Html.Div() { @Class = "error", Elements = { new Html.P { Elements = { new Html.EncodedText(errorMessage) } } } }; content.Elements.Add(errorDiv); } var form = new Html.Form { Method = "POST", Action = "./login" }; var submitCell = new Html.Td { Colspan = "2" }; if (redirectUri != null) { var redirectInput = new Html.Input { Name = "redirect_uri", Type = "hidden", Value = redirectUri.ToString() }; submitCell.Elements.Add(redirectInput); } var submitInput = new Html.Input { Type = "submit", Value = "Login" }; submitCell.Elements.Add(submitInput); var tbody = new Html.Tbody { Rows = { new Html.Tr { Cells = { new Html.Td { Elements = { new Html.EncodedText("Email Address:") } }, new Html.Td { Elements = { new Html.Input { Name = "username", Type = "text" } } } } }, new Html.Tr { Cells = { new Html.Td { Elements = { new Html.EncodedText("Password:"******"password", Type = "password" } } } } }, new Html.Tr { Cells = { submitCell } } } }; form.Elements.Add(new Html.Table { Tbody = tbody }); content.Elements.Add(form); }