Show More
@@ -68,8 +68,7 b' class UserModel(BaseModel):' | |||
|
68 | 68 | if case_insensitive: |
|
69 | 69 | user = self.sa.query(User).filter(User.username.ilike(username)) |
|
70 | 70 | else: |
|
71 |
user = self.sa.query(User) |
|
|
72 | .filter(User.username == username) | |
|
71 | user = self.sa.query(User).filter(User.username == username) | |
|
73 | 72 | if cache: |
|
74 | 73 | user = user.options(FromCache("sql_cache_short", |
|
75 | 74 | "get_user_%s" % username)) |
@@ -105,7 +104,8 b' class UserModel(BaseModel):' | |||
|
105 | 104 | raise |
|
106 | 105 | |
|
107 | 106 | def create_or_update(self, username, password, email, firstname='', |
|
108 |
lastname='', active=True, admin=False, ldap_dn=None, |
|
|
107 | lastname='', active=True, admin=False, ldap_dn=None, | |
|
108 | cur_user=None): | |
|
109 | 109 | """ |
|
110 | 110 | Creates a new instance if not found, or updates current one |
|
111 | 111 | |
@@ -118,6 +118,7 b' class UserModel(BaseModel):' | |||
|
118 | 118 | :param active: |
|
119 | 119 | :param admin: |
|
120 | 120 | :param ldap_dn: |
|
121 | :param cur_user: | |
|
121 | 122 | """ |
|
122 | 123 | if not cur_user: |
|
123 | 124 | cur_user = getattr(get_current_rhodecode_user(), 'username', None) |
@@ -163,6 +164,7 b' class UserModel(BaseModel):' | |||
|
163 | 164 | |
|
164 | 165 | :param username: |
|
165 | 166 | :param attrs: |
|
167 | :param cur_user: | |
|
166 | 168 | """ |
|
167 | 169 | if not cur_user: |
|
168 | 170 | cur_user = getattr(get_current_rhodecode_user(), 'username', None) |
@@ -203,6 +205,7 b' class UserModel(BaseModel):' | |||
|
203 | 205 | :param password: |
|
204 | 206 | :param user_dn: |
|
205 | 207 | :param attrs: |
|
208 | :param cur_user: | |
|
206 | 209 | """ |
|
207 | 210 | if not cur_user: |
|
208 | 211 | cur_user = getattr(get_current_rhodecode_user(), 'username', None) |
@@ -256,8 +259,7 b' class UserModel(BaseModel):' | |||
|
256 | 259 | '- Username: %s\n' |
|
257 | 260 | '- Full Name: %s\n' |
|
258 | 261 | '- Email: %s\n') |
|
259 | body = body % (new_user.username, new_user.full_name, | |
|
260 | new_user.email) | |
|
262 | body = body % (new_user.username, new_user.full_name, new_user.email) | |
|
261 | 263 | edit_url = url('edit_user', id=new_user.user_id, qualified=True) |
|
262 | 264 | kw = {'registered_user_url': edit_url} |
|
263 | 265 | NotificationModel().create(created_by=new_user, subject=subject, |
@@ -390,7 +392,7 b' class UserModel(BaseModel):' | |||
|
390 | 392 | |
|
391 | 393 | run_task(tasks.send_email, user_email, |
|
392 | 394 | _('Your new password'), |
|
393 | _('Your new RhodeCode password:%s') % (new_passwd)) | |
|
395 | _('Your new RhodeCode password:%s') % (new_passwd,)) | |
|
394 | 396 | log.info('send new password mail to %s' % user_email) |
|
395 | 397 | |
|
396 | 398 | except Exception: |
General Comments 0
You need to be logged in to leave comments.
Login now