Skip to content

Commit

Permalink
remove req and res from challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
gedaiu committed Apr 24, 2019
1 parent 050047d commit 6581d33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/vibeauth/challenges/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface IChallenge {
Json getConfig();

/// Validate the challenge
bool validate(HTTPServerRequest req, HTTPServerResponse res, string response);
bool validate(string response);
}

/// Secret code used to validate a challenge
Expand Down
2 changes: 1 addition & 1 deletion source/vibeauth/challenges/recaptcha.d
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ReCaptcha : IChallenge {
}

/// Validate the challenge
bool validate(HTTPServerRequest req, HTTPServerResponse res, string response) {
bool validate(string response) {
Json result;

requestHTTP("https://www.google.com/recaptcha/api/siteverify?secret=" ~ secretKey ~ "&response=" ~ response,
Expand Down
4 changes: 2 additions & 2 deletions source/vibeauth/router/registration/routes.d
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class RegistrationRoutes {
try {
requestData.validateUser;

if(!challenge.validate(req, res, requestData.response)) {
if(!challenge.validate(requestData.response)) {
throw new Exception("Invalid challenge `response`");
}

Expand Down Expand Up @@ -257,7 +257,7 @@ version(unittest) {
return "123";
}

bool validate(HTTPServerRequest, HTTPServerResponse, string response) {
bool validate(string response) {
return response == "123";
}

Expand Down

0 comments on commit 6581d33

Please sign in to comment.