diff --git a/app/controllers/Application.java b/app/controllers/Application.java index eef7926a249eb4f2f995e376eefefc7f97c2868f..f7f83ff249489a610ae2f8d7d5c070d38b376550 100644 --- a/app/controllers/Application.java +++ b/app/controllers/Application.java @@ -6,16 +6,12 @@ import play.mvc.Result; public class Application extends Controller { - public static Result encrypt(String pw) { - return ok(views.html.application.encrypted.render(BCryptExample.encrypt(pw))); - } - - public static Result matches(String pw) { - return ok(views.html.application.matches.render(BCryptExample.matchesLastEncrypted(pw))); + public static Result index() { + return internalServerError("Not implemented yet..."); } - public static Result index() { - return ok(views.html.application.index.render()); + public static Result matches() { + return internalServerError("Not implemented yet..."); } } diff --git a/app/model/Captcha.java b/app/model/Captcha.java index 52591037b41a57dddc37281742b6d9b06fb3438d..6e221f547678f1f4e8a13b742a0caf3efb207465 100644 --- a/app/model/Captcha.java +++ b/app/model/Captcha.java @@ -6,7 +6,11 @@ public class Captcha { * URLs of photos the user should select */ public static String[] yesPhotos = { - + "http://assets.dogtime.com/breed/profile/image/4d3771f10106195669001f8c/beagle.jpg", + "https://gdkennel.files.wordpress.com/2013/09/010.jpg", + "http://www.perros2.com/wp-content/uploads/2012/06/ddd.jpg", + "http://dogobedienceadvice.com/images/beagle_training.jpg", + "http://www.swish-swash.co.uk/images/beagle/beagles.jpg" }; @@ -14,7 +18,11 @@ public class Captcha { * URLs of photos the user should not select */ public static String[] noPhotos = { - + "http://www.pets4homes.co.uk/images/articles/1265/large/ten-reasons-why-dogs-make-better-pets-than-cats-52bc3172b4816.jpg", + "http://www.adweek.com/files/imagecache/node-blog/sa_article/dog_image_0.jpg", + "http://7-themes.com/data_images/out/36/6891162-dogs.jpg", + "http://www.boxer-dog.org/sites/default/files/imagecache/500_width/ruby2.jpg", + "http://www.imagepuppy.com/resized/762ce6cb8241c08d73ec9304b42f6d5f.jpg" }; /** diff --git a/app/views/application/encrypted.scala.html b/app/views/application/encrypted.scala.html deleted file mode 100644 index fc39c4d736c5f30e70a54882e99760f409cb56ea..0000000000000000000000000000000000000000 --- a/app/views/application/encrypted.scala.html +++ /dev/null @@ -1,21 +0,0 @@ -@(hash: String) - -<!DOCTYPE html> -<html> -<head lang="en"> - <meta charset="UTF-8"> - <title></title> -</head> -<body> - -<h1>Here's that encrypted with a new salt:</h1> -<p>@hash</p> - -<h2>Check a password matches the last one</h2> -<form action="matches"> - <input type="password" name="pw" /> - <button type="submit">Check</button> -</form> - -</body> -</html> \ No newline at end of file diff --git a/app/views/application/index.scala.html b/app/views/application/index.scala.html index 21adf5f5ec199af743fb0359ec109a6bfcb3938f..b2efaec0e81358da66ceef801d286867c52483be 100644 --- a/app/views/application/index.scala.html +++ b/app/views/application/index.scala.html @@ -1,16 +1,21 @@ -@() +@(indexes:Array[Int]) <!DOCTYPE html> + <html> <head lang="en"> + <meta name="referrer" content="no-referrer"> <meta charset="UTF-8"> <title></title> </head> <body> -<h1>Encrypt a password:</h1> -<form action="encrypt"> - <input type="password" name="pw" /> +<h1>Tick all the beagles:</h1> +<!-- TODO: This form probably has the wrong method... --> +<form action="captcha" > + <!-- + TODO: For each index in the array, show a checkbox with the value of the index, and the relevant img + --> <button type="submit">Submit</button> </form> diff --git a/app/views/application/matches.scala.html b/app/views/application/matches.scala.html index 8559cf929c2f612b9228e826ccaec41f618f10e5..d6653f075e5e2715bbaba387ea551c2c063ad254 100644 --- a/app/views/application/matches.scala.html +++ b/app/views/application/matches.scala.html @@ -1,4 +1,4 @@ -@(matches: Boolean) +@(beagles: Int, found: Int) <!DOCTYPE html> <html> @@ -8,17 +8,7 @@ </head> <body> -@if(matches) { - <h1>Yes, it matched!</h1> -} else { - <h2>Noo, that wasn't the password</h2> -} - -<h2>Check a password matches the last one</h2> -<form action="matches"> - <input type="password" name="pw" /> - <button type="submit">Check</button> -</form> + You found @found of @beagles beagles. </body> </html> \ No newline at end of file diff --git a/conf/routes b/conf/routes index b758168181dbc0a6ae5fc95db2dad352b8c10703..88b0c087c9f12b5fdb988757ff1e94e67347db3a 100644 --- a/conf/routes +++ b/conf/routes @@ -2,10 +2,8 @@ # This file defines all application routes (Higher priority routes first) # ~~~~ -# Home page GET / controllers.Application.index() -GET /encrypt controllers.Application.encrypt(pw) -GET /matches controllers.Application.matches(pw) +POST /matches controllers.Application.matches() # Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset) \ No newline at end of file