Commit | Line | Data |
---|---|---|
8e1e744d | 1 | # GNU MediaGoblin -- federated, autonomous media hosting |
cf29e8a8 | 2 | # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. |
8e1e744d WKG |
3 | # |
4 | # This program is free software: you can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
c3e3882e | 16 | from mediagoblin.tools.pluginapi import hook_handle, hook_runall |
ee355966 RE |
17 | |
18 | ||
b1e02e0a RE |
19 | def get_user(**kwargs): |
20 | """ Takes a kwarg such as username and returns a user object """ | |
21 | return hook_handle("auth_get_user", **kwargs) | |
ee355966 RE |
22 | |
23 | ||
c3e3882e RE |
24 | def create_user(register_form): |
25 | results = hook_runall("auth_create_user", register_form) | |
26 | return results[0] | |
ee355966 | 27 | |
c3e3882e RE |
28 | def extra_validation(register_form): |
29 | from mediagoblin.auth.tools import basic_extra_validation | |
ee355966 | 30 | |
c3e3882e RE |
31 | extra_validation_passes = basic_extra_validation(register_form) |
32 | if False in hook_runall("auth_extra_validation", register_form): | |
33 | extra_validation_passes = False | |
34 | return extra_validation_passes | |
ee355966 RE |
35 | |
36 | ||
9c2c9be7 RE |
37 | def gen_password_hash(raw_pass, extra_salt=None): |
38 | return hook_handle("auth_gen_password_hash", raw_pass, extra_salt) | |
14efa7bd RE |
39 | |
40 | ||
b194f29f RE |
41 | def check_password(raw_pass, stored_hash, extra_salt=None): |
42 | return hook_handle("auth_check_password", | |
43 | raw_pass, stored_hash, extra_salt) |