Show More
@@ -40,7 +40,7 b' from kallithea.lib.exceptions import Def' | |||
|
40 | 40 | UserOwnsReposException, UserCreationError |
|
41 | 41 | from kallithea.lib import helpers as h |
|
42 | 42 | from kallithea.lib.auth import LoginRequired, HasPermissionAllDecorator, \ |
|
43 | AuthUser, generate_api_key | |
|
43 | AuthUser | |
|
44 | 44 | import kallithea.lib.auth_modules.auth_internal |
|
45 | 45 | from kallithea.lib import auth_modules |
|
46 | 46 | from kallithea.lib.base import BaseController, render |
@@ -52,7 +52,7 b' from kallithea.model.user import UserMod' | |||
|
52 | 52 | from kallithea.model.meta import Session |
|
53 | 53 | from kallithea.lib.utils import action_logger |
|
54 | 54 | from kallithea.lib.compat import json |
|
55 | from kallithea.lib.utils2 import datetime_to_time, safe_int | |
|
55 | from kallithea.lib.utils2 import datetime_to_time, safe_int, generate_api_key | |
|
56 | 56 | |
|
57 | 57 | log = logging.getLogger(__name__) |
|
58 | 58 |
@@ -144,20 +144,6 b' def check_password(password, hashed):' | |||
|
144 | 144 | return KallitheaCrypto.hash_check(password, hashed) |
|
145 | 145 | |
|
146 | 146 | |
|
147 | def generate_api_key(str_, salt=None): | |
|
148 | """ | |
|
149 | Generates API KEY from given string | |
|
150 | ||
|
151 | :param str_: | |
|
152 | :param salt: | |
|
153 | """ | |
|
154 | ||
|
155 | if salt is None: | |
|
156 | salt = _RandomNameSequence().next() | |
|
157 | ||
|
158 | return hashlib.sha1(str_ + salt).hexdigest() | |
|
159 | ||
|
160 | ||
|
161 | 147 | class CookieStoreWrapper(object): |
|
162 | 148 | |
|
163 | 149 | def __init__(self, cookie_store): |
General Comments 0
You need to be logged in to leave comments.
Login now