X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=mediagoblin%2Fauth%2F__init__.py;h=f518a09d5ed9a75d9c42eee73d20accfe77a21a4;hb=5b014a08661f718bd92971e71d173a0ea4b62c40;hp=60cbdb0ef2c9ab39a23a4bde4785ee7277cddb80;hpb=0bd654a346936e8cfd25d678836ae538f50d9f17;p=mediagoblin.git diff --git a/mediagoblin/auth/__init__.py b/mediagoblin/auth/__init__.py index 60cbdb0e..f518a09d 100644 --- a/mediagoblin/auth/__init__.py +++ b/mediagoblin/auth/__init__.py @@ -13,39 +13,31 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from mediagoblin.tools.pluginapi import hook_handle +from mediagoblin.tools.pluginapi import hook_handle, hook_runall -def check_login(user, password): - result = hook_handle("auth_check_login", user, password) - if result: - return result - return False +def get_user(**kwargs): + """ Takes a kwarg such as username and returns a user object """ + return hook_handle("auth_get_user", **kwargs) -def get_user(*args): - return hook_handle("auth_get_user", *args) +def create_user(register_form): + results = hook_runall("auth_create_user", register_form) + return results[0] +def extra_validation(register_form): + from mediagoblin.auth.tools import basic_extra_validation -def create_user(*args): - return hook_handle("auth_create_user", *args) - - -def extra_validation(register_form, *args): - return hook_handle("auth_extra_validation", register_form, *args) - - -def get_user_metadata(user): - return hook_handle("auth_get_user_metadata", user) - - -def get_login_form(request): - return hook_handle("auth_get_login_form", request) - - -def get_registration_form(request): - return hook_handle("auth_get_registration_form", request) + extra_validation_passes = basic_extra_validation(register_form) + if False in hook_runall("auth_extra_validation", register_form): + extra_validation_passes = False + return extra_validation_passes def gen_password_hash(raw_pass, extra_salt=None): return hook_handle("auth_gen_password_hash", raw_pass, extra_salt) + + +def check_password(raw_pass, stored_hash, extra_salt=None): + return hook_handle("auth_check_password", + raw_pass, stored_hash, extra_salt)