Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Drupal 7 Bridge
- function my_module_authentication_menu_hook() {
- // Note anywhere below that I put return FALSE you should return a failed auth response.
- // Where there is a return TRUE you should return a successful auth response.
- // The formatting of the auth response is up to you with how your Moodle call will react.
- if (!isset($_POST['username']) || !isset($_POST['password'])) {
- return FALSE;
- }
- $username = $_POST['username'];
- $password = $_POST['password'];
- // Functionality from user_login_name_validate().
- if (user_is_blocked($username)) {
- return FALSE;
- }
- // Functionality from user_login_authenticate_validate().
- // You should add flood handling in here as well, but it can not be IP based, unless you
- // supply the IP of the user through your Moodle functionality.
- if (user_authenticate($username, $password) === FALSE) {
- return FALSE;
- }
- // See user_login_final_validate() and implement failed login functionality before success.
- return TRUE;
- }
Add Comment
Please, Sign In to add comment