Skip to content

Commit 04e9970

Browse files
committed
Inject ReCaptcha via DI
Addresses #225 (comment).
1 parent 4bb6586 commit 04e9970

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scalajvm/app/controllers/SuggestedQuotes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import scala.concurrent.Await
1414
import scala.concurrent.duration._
1515

1616
@Singleton
17-
class SuggestedQuotes @Inject()(implicit cc: ControllerComponents, configuration: Configuration) extends AbstractController(cc) with i18n.I18nSupport {
17+
class SuggestedQuotes @Inject()(implicit cc: ControllerComponents, configuration: Configuration, recaptcha: ReCaptcha) extends AbstractController(cc) with i18n.I18nSupport {
1818
def newQuote() = Action { implicit request =>
1919
Ok(views.html.newQuote(quoteForm))
2020
}
@@ -29,7 +29,7 @@ class SuggestedQuotes @Inject()(implicit cc: ControllerComponents, configuration
2929
},
3030
form => {
3131
val remoteAddress = request.remoteAddress
32-
if (Await.result((new ReCaptcha).check(remoteAddress, form.reCapthaResponse), 30.seconds)) { // TODO: Async check
32+
if (Await.result(recaptcha.check(remoteAddress, form.reCapthaResponse), 30.seconds)) { // TODO: Async check
3333
SuggestedQuoteService.insertAndNotify(form.content, remoteAddress, "user")
3434
Ok(views.html.quoteSuggested())
3535
} else {

0 commit comments

Comments
 (0)