I realized after creating my users table that there is a better way to
setup authentication found here...
http://mdp.cti.depaul.edu/examples/default/tools#authentication
But I can't seem to figure out how to modify my current "users" table to
work with the new class...
----
from gluon.tools import Auth
class MyAuth(Auth):
def __init__(self, environment, T, db = None):
"Initialise parent class & make any necessary modifications"
Auth.__init__(self,environment,db)
self.messages.logged_in = T("Logged in")
self.messages.email_sent = T("Email sent")
self.messages.email_verified = T("Email verified")
self.messages.logged_out = T("Logged out")
self.messages.registration_succesful = T("Registration successful")
self.messages.invalid_email = T("Invalid email")
self.messages.invalid_login = T("Invalid login")
self.messages.verify_email_subject = T("Password verify")
self.messages.username_sent = T("Your username was emailed to you")
self.messages.new_password_sent = T("A new password was emailed to you")
self.messages.invalid_email = T("Invalid email")
self.messages.password_changed = T("Password changed")
self.messages.retrieve_username=str(T("Your username is"))+":
%(username)s"
self.messages.retrieve_username_subject="Username retrieve"
self.messages.retrieve_password=str(T("Your password is"))+":
%(password)s"
self.messages.retrieve_password_subject = T("Password retrieve")
self.messages.profile_updated = T("Profile updated")
auth = MyAuth(globals(), T, db)
----
do I just modify the line...
def __init__ (self, environment, T, db = db.users):
and make sure I have at least the basic table required for auth?
My current 'users' table is as follows:
---
db.define_table('users',
SQLField('nickname', length=25),
SQLField('email_address', 'string'),
SQLField('first_name', 'string'),
SQLField('last_name', 'string'),
SQLField('password', 'password'),
SQLField('created', 'date', default=now),
SQLField('deleted', 'string'),
SQLField('verified', 'boolean', default= False),
SQLField('position', 'string'),
SQLField('profile_text', 'text'),
SQLField('profile_photo', 'upload', default=''),
SQLField('homepage', 'string'))
#Setup the users table
db.users.nickname.requires = [IS_NOT_IN_DB(db, 'users.nickname')]
db.users.email_address.requires = [IS_EMAIL(), IS_NOT_IN_DB(db,
'users.email_address')]
db.users.first_name.requires = IS_NOT_EMPTY()
db.users.last_name.requires = IS_NOT_EMPTY()
db.users.password.requires = IS_NOT_EMPTY()
db.users.position.requires = IS_NOT_EMPTY()
db.users.nickname.requires = IS_NOT_EMPTY()
---
Ideas?
---
Regards,
Jason Brower
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---