Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
7b045638
Commit
7b045638
authored
Jun 07, 2013
by
Matija Obreza
Browse files
reCAPTCHA in .properties
parent
68d790ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/crophub/rest/servlet/controller/HtmlController.java
View file @
7b045638
...
@@ -30,6 +30,7 @@ import org.crophub.rest.common.model.UserRole;
...
@@ -30,6 +30,7 @@ import org.crophub.rest.common.model.UserRole;
import
org.crophub.rest.common.model.impl.User
;
import
org.crophub.rest.common.model.impl.User
;
import
org.crophub.rest.common.service.UserService
;
import
org.crophub.rest.common.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
...
@@ -53,6 +54,12 @@ public class HtmlController extends BaseController {
...
@@ -53,6 +54,12 @@ public class HtmlController extends BaseController {
@Autowired
@Autowired
private
Validator
validator
;
private
Validator
validator
;
@Value
(
"${captcha.privateKey}"
)
private
String
captchaPrivateKey
;
@Value
(
"${captcha.publicKey}"
)
private
String
captchaPublicKey
;
@RequestMapping
(
"/"
)
@RequestMapping
(
"/"
)
public
String
welcome
()
{
public
String
welcome
()
{
return
"redirect:/index.html"
;
return
"redirect:/index.html"
;
...
@@ -71,7 +78,8 @@ public class HtmlController extends BaseController {
...
@@ -71,7 +78,8 @@ public class HtmlController extends BaseController {
}
}
@RequestMapping
(
value
=
"registration.html"
)
@RequestMapping
(
value
=
"registration.html"
)
public
String
registration
()
{
public
String
registration
(
ModelMap
model
)
{
model
.
addAttribute
(
"captchaPublicKey"
,
captchaPublicKey
);
return
"/registration"
;
return
"/registration"
;
}
}
...
@@ -88,7 +96,7 @@ public class HtmlController extends BaseController {
...
@@ -88,7 +96,7 @@ public class HtmlController extends BaseController {
// Probably don't want to hardcode your private key here but
// Probably don't want to hardcode your private key here but
// just to get it working is OK...
// just to get it working is OK...
reCaptcha
.
setPrivateKey
(
"6LdwDuESAAAAAORNI10cwpgDMrGZbJteKGBu5ccI"
);
reCaptcha
.
setPrivateKey
(
captchaPrivateKey
);
ReCaptchaResponse
reCaptchaResponse
=
reCaptcha
.
checkAnswer
(
remoteAddr
,
challenge
,
response
);
ReCaptchaResponse
reCaptchaResponse
=
reCaptcha
.
checkAnswer
(
remoteAddr
,
challenge
,
response
);
...
...
src/main/resources/spring/spring.properties
View file @
7b045638
...
@@ -24,3 +24,8 @@ db.url=jdbc:mysql://192.168.56.101/aimprosoft?useUnicode=true&characterEncoding=
...
@@ -24,3 +24,8 @@ db.url=jdbc:mysql://192.168.56.101/aimprosoft?useUnicode=true&characterEncoding=
db.driverClassName
=
com.mysql.jdbc.Driver
db.driverClassName
=
com.mysql.jdbc.Driver
db.username
=
root
db.username
=
root
db.password
=
mysql
db.password
=
mysql
# reCAPTCHA API
captcha.privateKey
=
A
captcha.publicKey
=
B
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment