source: OpenRLabs-Git/web2py/applications/rlabs/models/m0_auth_users_and_groups.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100644
File size: 719 bytes
Line 
1# -*- coding: utf-8 -*-
2
3db.auth_user.id.readable = False
4db.auth_user.password.readable = False
5db.auth_user.password.writable = False
6
7db.auth_user.email.unique = True # Only works on forms
8
9
10db.auth_membership.id.readable = False
11
12
13
14
15def enable_user(row, id):
16    enabled_id = db(db.auth_group.role == 'enabled').select().first()['id']
17    db.auth_membership.insert(user_id = id,
18                              group_id = enabled_id)
19
20
21
22db.auth_user._after_insert.append(lambda row, id: enable_user(row, id))
23
24
25
26def reset_passwd(row):
27    user_id = row.select().first()["user_id"]   
28    db(db.auth_user.id == user_id).update(password = None)
29
30
31db.auth_membership._before_delete.append(lambda row: reset_passwd(row))
Note: See TracBrowser for help on using the repository browser.