added focus to form input
[mediagoblin.git] / mediagoblin / auth / __init__.py
CommitLineData
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 16from mediagoblin.tools.pluginapi import hook_handle, hook_runall
ee355966
RE
17
18
d54cf48a 19def check_login(user, password):
0bd654a3
RE
20 result = hook_handle("auth_check_login", user, password)
21 if result:
22 return result
23 return False
ee355966
RE
24
25
c3e3882e
RE
26def get_user(form):
27 return hook_handle("auth_get_user", form)
ee355966
RE
28
29
c3e3882e
RE
30def create_user(register_form):
31 results = hook_runall("auth_create_user", register_form)
32 return results[0]
ee355966
RE
33
34
c3e3882e
RE
35def extra_validation(register_form):
36 from mediagoblin.auth.tools import basic_extra_validation
ee355966 37
c3e3882e
RE
38 extra_validation_passes = basic_extra_validation(register_form)
39 if False in hook_runall("auth_extra_validation", register_form):
40 extra_validation_passes = False
41 return extra_validation_passes
ee355966
RE
42
43
44def get_login_form(request):
45 return hook_handle("auth_get_login_form", request)
46
47
48def get_registration_form(request):
49 return hook_handle("auth_get_registration_form", request)
9c2c9be7
RE
50
51
52def gen_password_hash(raw_pass, extra_salt=None):
53 return hook_handle("auth_gen_password_hash", raw_pass, extra_salt)
14efa7bd
RE
54
55
56def fake_login_attempt():
57 return hook_handle("auth_fake_login_attempt")