Permalink
Browse files

Newly created with PayPal integration

  • Loading branch information...
rasesh committed Mar 28, 2011
1 parent ba96510 commit 005ef954fd7a8ac8c87d19f6932d532b425f1a33
Showing with 2,408 additions and 0 deletions.
  1. +63 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Account/Login.cshtml
  2. +4 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Account/Logout.cshtml
  3. +96 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Account/Register.cshtml
  4. +18 −0 OrlandoCodeCamp/PhotoSharing-PayPal/App_Code/EnumerableExtensions.cs
  5. +729 −0 OrlandoCodeCamp/PhotoSharing-PayPal/App_Code/Facebook.cshtml
  6. +146 −0 OrlandoCodeCamp/PhotoSharing-PayPal/App_Code/MultiThumbnailGenerator.cs
  7. +13 −0 OrlandoCodeCamp/PhotoSharing-PayPal/App_Code/PhotoGallery.cshtml
  8. BIN OrlandoCodeCamp/PhotoSharing-PayPal/App_Data/PhotoGallery.sdf
  9. BIN ...p/PhotoSharing-PayPal/App_Data/packages/microsoft-web-helpers.1.0/microsoft-web-helpers.1.0.nupkg
  10. +4 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Default.cshtml
  11. +31 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Gallery/Default.cshtml
  12. +42 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Gallery/New.cshtml
  13. +35 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Gallery/Thumbnail.cshtml
  14. +49 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Gallery/Upload.cshtml
  15. +41 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Gallery/View.cshtml
  16. BIN OrlandoCodeCamp/PhotoSharing-PayPal/Images/download.png
  17. BIN OrlandoCodeCamp/PhotoSharing-PayPal/Images/gallery-empty.png
  18. BIN OrlandoCodeCamp/PhotoSharing-PayPal/Images/header-bkg.png
  19. BIN OrlandoCodeCamp/PhotoSharing-PayPal/Images/icon-account.png
  20. BIN OrlandoCodeCamp/PhotoSharing-PayPal/Images/icon-gallery.png
  21. BIN OrlandoCodeCamp/PhotoSharing-PayPal/Images/icon-tags.png
  22. +58 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/Edit.cshtml
  23. +68 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/EditTags.cshtml
  24. +15 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/Full.cshtml
  25. +51 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/OrderSuccess.cshtml
  26. +45 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/Remove.cshtml
  27. +38 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/Thumbnail.cshtml
  28. +146 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Photo/View.cshtml
  29. +456 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Styles/Site.css
  30. +30 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Tag/Default.cshtml
  31. +33 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Tag/Thumbnail.cshtml
  32. +45 −0 OrlandoCodeCamp/PhotoSharing-PayPal/Tag/View.cshtml
  33. +48 −0 OrlandoCodeCamp/PhotoSharing-PayPal/User/Default.cshtml
  34. +53 −0 OrlandoCodeCamp/PhotoSharing-PayPal/User/View.cshtml
  35. +12 −0 OrlandoCodeCamp/PhotoSharing-PayPal/_AppStart.cshtml
  36. +4 −0 OrlandoCodeCamp/PhotoSharing-PayPal/_PageStart.cshtml
  37. +33 −0 OrlandoCodeCamp/PhotoSharing-PayPal/_SiteLayout.cshtml
  38. BIN OrlandoCodeCamp/PhotoSharing-PayPal/bin/Microsoft.Web.Helpers.dll
  39. BIN OrlandoCodeCamp/PhotoSharing-PayPal/bin/PayPal.dll
  40. BIN OrlandoCodeCamp/PhotoSharing-PayPal/favicon.ico
  41. +2 −0 OrlandoCodeCamp/PhotoSharing-PayPal/robots.txt
@@ -0,0 +1,63 @@
+@{
+ Page.Title = "Login";
+
+ if (IsPost) {
+ var email = Request["email"];
+ if (email.IsEmpty()) {
+ ModelState.AddError("email", "You must specify an email address.");
+ }
+
+ var password = Request["password"];
+ if (password.IsEmpty()) {
+ ModelState.AddError("password", "You must specify a password.");
+ }
+
+ if (ModelState.IsValid) {
+ var rememberMe = Request["rememberMe"].AsBool();
+ if (WebSecurity.Login(email, password, rememberMe)) {
+ string returnUrl = Request["returnUrl"];
+ if (!returnUrl.IsEmpty()) {
+ Context.RedirectLocal(returnUrl);
+ } else{
+ Response.Redirect("~/");
+ }
+ } else {
+ ModelState.AddFormError("The email or password provided is incorrect.");
+ }
+ }
+ }
+}
+
+<h1>Login</h1>
+
+<p>
+ Please enter your email and password below. If you don't have an account,
+ please <a href="@Href("Register")">Register</a>.
+</p>
+
+@Html.ValidationSummary(excludeFieldErrors: true)
+
+<form method="post" action="">
+ <fieldset class="no-legend">
+ <legend>Login</legend>
+ <ol>
+ <li class="email">
+ <label for="email">Email</label>
+ <input type="text" id="email" name="email" title="Email Address" placeholder="Email address" class="@PhotoGallery.GetValidationClass("email")" />
+ @Html.ValidationMessage("email")
+ </li>
+ <li class="Password">
+ <label for="password">Password</label>
+ <input type="password" id="password" name="password" title="Password" class="@PhotoGallery.GetValidationClass("password")" />
+ @Html.ValidationMessage("password")
+ </li>
+ <li class="remember-me">
+ <label class="checkbox" for="rememberMe">Remember Me?</label>
+ <input type="checkbox" id="rememberMe" name="rememberMe" value="true" title="Remember Me" />
+ </li>
+ </ol>
+ <p class="form-actions">
+ <input type="submit" value="Login" title="Login" />
+ </p>
+ </fieldset>
+</form>
@@ -0,0 +1,4 @@
+@{
+ WebSecurity.Logout();
+ Response.Redirect("~/");
+}
@@ -0,0 +1,96 @@
+@{
+ Page.Title = "Register";
+
+ if (IsPost) {
+ //if (!ReCaptcha.Validate("PRIVATE_KEY")) {
+ // ModelState.AddFormError("Captcha response was not correct.");
+ //}
+
+ var email = Request["email"];
+ if (email.IsEmpty()) {
+ ModelState.AddError("email", "You must specify an email address.");
+ }
+
+ var password = Request["password"];
+ var confirmPassword = Request["confirmPassword"];
+
+ if (password.IsEmpty()) {
+ ModelState.AddError("password", "You must specify a password.");
+ }
+
+ if (confirmPassword.IsEmpty()) {
+ ModelState.AddError("confirmPassword", "You must specify a confirm password.");
+ }
+
+ if (password != confirmPassword) {
+ ModelState.AddFormError("The new password and confirmation password do not match.");
+ }
+
+ if (ModelState.IsValid) {
+ // Create the user profile
+ var db = Database.Open("PhotoGallery");
+
+ // Check if user already exists
+ var user = db.QuerySingle("SELECT Email FROM UserProfiles WHERE LOWER(Email) = LOWER(@0)", email);
+ if (user == null) {
+ // Insert email into the profile table
+ db.Execute("INSERT INTO UserProfiles (Email, DisplayName, Bio) VALUES (@0, @1, @2)", email, email, "");
+
+ // Create and associate a new entry in the membership database.
+ // If successful, continue processing the request
+ try {
+ WebSecurity.CreateAccount(email, password);
+ WebSecurity.Login(email, password);
+ Response.Redirect("~/");
+ } catch (System.Web.Security.MembershipCreateUserException e) {
+ ModelState.AddFormError(e.ToString());
+ }
+ } else {
+ // User already exists
+ ModelState.AddFormError("Email address is already in use.");
+ }
+ }
+ }
+}
+
+<h1>Account Creation</h1>
+<p>
+ Use the form below to create a new account.
+</p>
+
+@Html.ValidationSummary(excludeFieldErrors: true)
+
+<form method="post" action="">
+ <fieldset class="no-legend">
+ <legend>Account Creation</legend>
+ <ol>
+ <li class="email">
+ <label for="email">Email:</label>
+ <input type="text" id="email" name="email" title="Email address" placeholder="Email address" class="@PhotoGallery.GetValidationClass("email")" />
+ @Html.ValidationMessage("email")
+ </li>
+ <li class="password">
+ <label for="password">Password:</label>
+ <input type="password" id="password" name="password" title="Password" class="@PhotoGallery.GetValidationClass("password")" />
+ @Html.ValidationMessage("password")
+ </li>
+ <li class="confirm-password">
+ <label for="confirmPassword">Confirm Password:</label>
+ <input type="password" id="confirmPassword" name="confirmPassword" title="Confirm password" class="@PhotoGallery.GetValidationClass("confirmPassword")" />
+ @Html.ValidationMessage("confirmPassword")
+ </li>
+ <li class="recaptcha">
+ <div class="message info">
+ <p>To enable CAPTCHA verification, uncomment ReCaptcha.GetHtml and replace 'PUBLIC_KEY'
+ with your public key. At the top of this page, uncomment ReCaptcha.Validate and
+ replace 'PRIVATE_KEY' with your private key.</p>
+ <p>Register for reCAPTCHA keys at <a href="http://recaptcha.net">reCAPTCHA.net</a>.</p>
+ </div>
+ @*@ReCaptcha.GetHtml("PUBLIC_KEY", theme: "white")*@
+ </li>
+ </ol>
+ <p class="form-actions">
+ <input type="submit" value="Register" title="Register" />
+ </p>
+ </fieldset>
+</form>
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+public static class EnumerableExtensions {
+
+ public static IEnumerable<TSource> Shuffle<TSource>(this IEnumerable<TSource> source) {
+ List<TSource> list = source.ToList();
+ Random random = new Random();
+
+ for (int i = list.Count - 1; i >= 0; i--) {
+ int r = random.Next(i + 1);
+ yield return list[r];
+ list[r] = list[i];
+ }
+ }
+
+}
Oops, something went wrong.

0 comments on commit 005ef95

Please sign in to comment.