|
@@ -275,6 +275,11 @@ class UserRestController(TIMRestController):
|
275
|
275
|
profile = UserProfileAdminRestController()
|
276
|
276
|
workspaces = UserWorkspaceRestController()
|
277
|
277
|
|
|
278
|
+ PASSWORD_LENGTH = 12
|
|
279
|
+ PASSWORD_CHARACTERS = '0123456789' \
|
|
280
|
+ 'abcdefghijklmonpqrstuvwxyz' \
|
|
281
|
+ 'ABCDEFGHIJKLMONPQRSTUVWXYZ'
|
|
282
|
+
|
278
|
283
|
@classmethod
|
279
|
284
|
def current_item_id_key_in_context(cls):
|
280
|
285
|
return 'user_id'
|
|
@@ -354,21 +359,20 @@ class UserRestController(TIMRestController):
|
354
|
359
|
tg.redirect(self.url())
|
355
|
360
|
|
356
|
361
|
@classmethod
|
357
|
|
- def generate_password(cls):
|
358
|
|
- # Characters available to generate a password
|
359
|
|
- characters = '0123456789' \
|
360
|
|
- 'abcdefghijklmonpqrstuvwxyz' \
|
361
|
|
- 'ABCDEFGHIJKLMONPQRSTUVWXYZ'
|
|
362
|
+ def generate_password(
|
|
363
|
+ cls,
|
|
364
|
+ password_length = PASSWORD_LENGTH,
|
|
365
|
+ password_char = PASSWORD_CHARACTERS
|
|
366
|
+ ):
|
362
|
367
|
|
363
|
368
|
# character list that will be contained into the password
|
364
|
|
- list_char = []
|
|
369
|
+ char_list = []
|
365
|
370
|
|
366
|
|
- pass_length = int(CFG.get_instance().AUTO_GENERATED_PASSWORD_LENGTH)
|
367
|
|
- for j in range(0, pass_length):
|
|
371
|
+ for j in range(0, password_length):
|
368
|
372
|
# This puts a random char from the list above inside
|
369
|
373
|
# the list of chars and then merges them into a String
|
370
|
|
- list_char.append(random.choice(characters))
|
371
|
|
- password = ''.join(list_char)
|
|
374
|
+ char_list.append(random.choice(password_char))
|
|
375
|
+ password = ''.join(char_list)
|
372
|
376
|
return password
|
373
|
377
|
|
374
|
378
|
@tg.expose('tracim.templates.admin.user_getone')
|