aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/api.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-14 23:22:13 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-14 23:22:13 +0000
commit25530a3caf7ea6714f22830a4792756507a722b0 (patch)
tree1da40b8831853f1240ad80cc94a09fbfaf00601b /engine/lib/api.php
parent202241825d11a2b7952e42a222857da90921bdca (diff)
downloadelgg-25530a3caf7ea6714f22830a4792756507a722b0.tar.gz
elgg-25530a3caf7ea6714f22830a4792756507a722b0.tar.bz2
Refs #1417 Elgg core now passes back useful messages to user when log in fails - uservalidationbyemail is next
git-svn-id: http://code.elgg.org/elgg/trunk@7317 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/api.php')
-rw-r--r--engine/lib/api.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/engine/lib/api.php b/engine/lib/api.php
index 7313fb5e9..2c566b479 100644
--- a/engine/lib/api.php
+++ b/engine/lib/api.php
@@ -170,17 +170,19 @@ function authenticate_method($method) {
// check API authentication if required
if ($API_METHODS[$method]["require_api_auth"] == true) {
- if (pam_authenticate(null, "api") == false) {
+ $api_pam = new ElggPAM('api');
+ if ($api_pam->authenticate() !== true) {
throw new APIException(elgg_echo('APIException:APIAuthenticationFailed'));
}
}
- $user_auth_result = pam_authenticate();
+ $user_pam = new ElggPAM('user');
+ $user_auth_result = $user_pam->authenticate();
// check if user authentication is required
if ($API_METHODS[$method]["require_user_auth"] == true) {
if ($user_auth_result == false) {
- throw new APIException(elgg_echo('APIException:UserAuthenticationFailed'));
+ throw new APIException($user_pam->getFailureMessage());
}
}