diff options
Diffstat (limited to 'modules/blogapi')
-rw-r--r-- | modules/blogapi/blogapi.module | 11 | ||||
-rw-r--r-- | modules/blogapi/blogapi.test | 1 |
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module index ef8e22693..9f9549bb3 100644 --- a/modules/blogapi/blogapi.module +++ b/modules/blogapi/blogapi.module @@ -683,13 +683,14 @@ function blogapi_error($message) { * Ensure that the given user has permission to edit a blog. */ function blogapi_validate_user($username, $password) { - global $user; + $form_state['values']['name'] = $username; + $form_state['values']['pass'] = $password; + $form_state['values']['op'] = t('Login'); + drupal_form_submit('user_login', $form_state); - $user = user_authenticate(array('name' => $username, 'pass' => $password)); - - if ($user->uid) { + if (!form_get_error()) { if (user_access('administer content with blog api', $user)) { - return $user; + return $GLOBALS['user']; } else { return t('You do not have permission to edit this blog.'); diff --git a/modules/blogapi/blogapi.test b/modules/blogapi/blogapi.test index 4ca1ad15d..fb463a430 100644 --- a/modules/blogapi/blogapi.test +++ b/modules/blogapi/blogapi.test @@ -31,7 +31,6 @@ class BlogAPITestCase extends DrupalWebTestCase { // Create user. $web_user = $this->drupalCreateUser(array('create blog content', 'delete own blog content', 'edit own blog content', 'administer content with blog api')); - $this->drupalLogin($web_user); // Init common variables. $local = url($base_url . '/xmlrpc.php', array('external' => TRUE)); |