forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefault.aspx
More file actions
299 lines (258 loc) · 10.4 KB
/
Default.aspx
File metadata and controls
299 lines (258 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ServiceStack.WebHost.IntegrationTests.Default" %>
<%@ Import Namespace="ServiceStack.Html" %>
<%@ Import Namespace="ServiceStack.Text" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Authentication / Validation tests</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le styles -->
<link href="Content/bootstrap.css" rel="stylesheet" />
<link href="Content/default.css" rel="stylesheet" />
<%=ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw() %>
<script src="Content/js/jquery-1.7.1.min.js" type="text/javascript"></script> <script src="Content/js/underscore.min.js" type="text/javascript"></script> <script src="Content/js/backbone.min.js" type="text/javascript"></script> <script src="Content/js/jsonreport.js" type="text/javascript"></script> <script src="api/js/ss-utils.js" type="text/javascript"></script> <style type="text/css">
body {
padding-top: 60px;
}
</style>
</head>
<body>
<div class="topbar"> <div class="fill"> <div class="container"> <a class="brand" href="/">Home</a> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> <li><a href="api/auth/logout">Log Off</a></li> </ul> </div> </div> </div>
<div id="login" class="container">
<h2 id="title">Authentication / Validation tests</h2>
<div class="row">
<div id="signin" class="span12 columns">
<form class="span5 columns form-stacked fade-when-loading" action="api/auth/credentials" method="POST">
<div>
<fieldset>
<legend>Sign In</legend>
<div class="clearfix"> <label for="UserName">Email Address</label> <input id="UserName" name="UserName" type="text" value="" /> <span class="help-inline"></span> </div>
<div class="clearfix"> <label for="Password">Password</label> <input id="Password" name="Password" type="password" /> <span class="help-inline"></span> </div>
<div class="clearfix"> <div class="input"> <ul class="inputs-list"> <li> <label> <input id="RememberMe" name="RememberMe" type="checkbox" value="true" /> <span>Remember me</span> </label> </li> </ul> </div> <span class="help-block"></span> </div>
<p>
<span class="error-summary"></span>
</p>
<p>
<button class="btn" type="submit">Sign In</button><b data-ajax="loading"></b>
or <a href="#" data-click="toggle:register,signin">register</a>
</p>
<div id="facebook-signin">
<a href="api/auth/facebook"><img src="Content/img/sign-in-with-facebook.png" alt="Sign-in with Facebook" /></a>
</div>
</fieldset>
</div>
</form>
<div class="span4 columns">
<h3>Become a Member</h3>
<p>
Lorem ipsum dolor sit amet,
consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut
laoreet dolore magna aliquam erat volutpat.
</p>
<button class="btn large primary" data-click="toggle:register,signin">Register Now</button>
</div>
</div>
</div>
<div class="row">
<div id="register" class="hide span12 columns">
<form class="span8 columns form-stacked fade-when-loading" action="api/register" method="POST">
<div>
<fieldset>
<legend>Create your member account</legend>
<div class="clearfix"> <label for="DisplayName">DisplayName</label> <input id="DisplayName" name="DisplayName" type="text" value="" /> <span class="help-inline"></span> </div>
<div class="clearfix"> <label for="Email">Email</label> <input id="Email" name="Email" type="text" value="" /> <span class="help-inline"></span> </div>
<div class="clearfix"> <label for="Password">Password</label> <input id="Password" name="Password" type="password" /> <span class="help-inline"></span> </div>
<div class="clearfix"> <label for="ConfirmPassword">ConfirmPassword</label> <input id="ConfirmPassword" name="ConfirmPassword" type="password" /> <span class="help-inline"></span> </div>
<p>
<small>By registering you agree to the <a href="#">Terms & Conditions</a></small>
</p>
<span class="error-summary"></span>
<p>
<button class="btn" type="submit">Sign Up</button><b data-ajax="loading"></b>
or <a href="#" data-click="toggle:signin,register">sign in</a>
</p>
</fieldset>
</div>
</form>
</div>
</div>
<p></p>
<div class="alert-message success hide"><a class="close" href="#">×</a><p></p></div>
<h3>Session Info</h3>
<% if (UserSession.IsAuthenticated) { %>
<div class="alert-message success">
<a class="close" href="#">×</a>
<p><strong>Contgratulations!</strong> You are authenticated</p>
</div>
<% } %>
<pre>
<%= UserSession.Dump() %>
</pre>
<div id="userauths"></div>
<div id="oAuthProviders"></div>
<script type="text/javascript">
$.getJSON("api/userauths", function (r) {
$("#userauths").html(_.jsonreport(r.results));
$("#oAuthProviders").html(_.jsonreport(r.oAuthProviders));
});
</script>
<script type="text/javascript">
$(document).applyValues({
UserName: 'as@if.com',
DisplayName: 'mythz',
Email: 'as@if.com',
Password: 'test',
ConfirmPassword: 'test'
});
function success(r) {
var msg = r.userName
? "<strong>Welcome " + r.userName + "!</strong> your sessionId is <b>" + r.sessionId + "</b>."
: r.userId
? "<strong>Welcome</strong> you are user #" + r.userId
+ "! You should now <a href='#' data-click='toggle:signin,register'>sign in</a>."
: "";
if (msg) {
$(".success P").html(msg);
$(".success").fadeIn();
}
}
$("#signin FORM").bindForm({
success: success
});
$("#register FORM").bindForm({
validate: function () {
console.log("validate", $(this).serializeMap());
var formData = $(this).serializeMap();
if (formData["ConfirmPassword"] != formData["Password"]) {
$(this).setFieldError("Password", "passwords do not match");
return false;
}
},
success: function(r) {
$("#signin #UserName").val($("#register #Email").val());
success(r);
}
});
$(document).bindHandlers({
toggle: function (show, hide) {
$("#" + hide).hide();
$("#" + show).fadeIn();
}
});
</script>
<h2>Test Redirect</h2>
<form action="api/auth/GoogleOpenId" method="POST">
<p>
<button class="btn" type="submit">Sign In with Google OpenId</button>
</p>
</form>
<form action="api/auth/OpenId" method="POST">
<p>
<input type="text" name="OpenIdUrl" placeholder="e.g. http://{user}.myopenid.com"/>
<button class="btn" type="submit">Sign In with OpenId</button>
</p>
</form>
<form action="api/auth/credentials" method="POST">
<div>
<fieldset>
<legend>Sign In w/ Redirect</legend>
<div class="clearfix"> <label for="UserName">Email Address</label> <input id="Text1" name="UserName" type="text" value="" /> </div>
<div class="clearfix"> <label for="Password">Password</label> <input id="Password1" name="Password" type="password" /> </div>
<div class="clearfix"> <label for="Continue">Continue</label> <input id="Password2" name="Continue" type="text" value="http://google.com" /> </div>
<div class="clearfix"> <div class="input"> <ul class="inputs-list"> <li> <label> <input id="Checkbox1" name="RememberMe" type="checkbox" value="true" /> <span>Remember me</span> </label> </li> </ul> </div> <span class="help-block"></span> </div>
<p>
<span class="error-summary"></span>
</p>
<p>
<button class="btn" type="submit">Sign In</button>
</p>
</fieldset>
</div>
</form>
<footer>
<p>© Company 2012</p>
</footer>
</div> <!-- /container -->
</body>
</html>