dump_creds reset les mdp
This commit is contained in:
parent
8a5822d4df
commit
6173bc8e89
3 changed files with 55 additions and 25 deletions
|
@ -2,9 +2,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
import string
|
||||
import datetime
|
||||
import random
|
||||
import sys
|
||||
from lc_ldap import crans_utils
|
||||
from lc_ldap.shortcuts import lc_ldap_admin
|
||||
|
@ -12,13 +9,6 @@ from client import Ticket
|
|||
|
||||
conn = lc_ldap_admin()
|
||||
|
||||
def gen_password():
|
||||
"""Génère un mot de passe aléatoire"""
|
||||
random.seed(datetime.datetime.now().microsecond)
|
||||
chars = string.letters + string.digits + '/=+*'
|
||||
length = 10
|
||||
return ''.join([random.choice(chars) for _ in xrange(length)])
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Veuillez taper UN login")
|
||||
exit(1)
|
||||
|
@ -29,13 +19,6 @@ if not adh:
|
|||
exit(1)
|
||||
adh = adh[0]
|
||||
|
||||
try:
|
||||
value = gen_password()
|
||||
adh['userPassword'] = [crans_utils.hash_password(value).decode('ascii')]
|
||||
except EnvironmentError:
|
||||
print("Impossible de changer le mot de passe de %s" % login)
|
||||
exit(2)
|
||||
|
||||
ticket = Ticket()
|
||||
ticket.add_account(login, value)
|
||||
ticket.reset_password(adh)
|
||||
ticket.print()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue