Hi,
I want to customize the auth functionality to add a user id(or name).
This is what I've done so far.
DB:

from gluon.tools import Auth
auth=Auth(globals(),db)
auth.settings.table_user=db.define_table(
        auth.settings.table_user_name,
        Field('user_name',length=128,default='',requires=[IS_NOT_IN_DB
(db,'%s.user_name'%auth.settings.table_user_name)]),
        Field('first_name', length=128, default=''),
        Field('last_name',length=128, default=''),
        Field('email',length=128,default='',requires=[IS_EMAIL(), IS_NOT_IN_DB
(db,'%s.email'%auth.settings.table_user_name)]),
        Field('password', 'password', readable=False, label='Password',
requires=CRYPT()),
        Field('registration_key', length=128, writable=False,
readable=False,default=''))
##create all necessary tables
auth.define_tables()

CONTROLLER:

def register():
    return dict(form=auth.register(next='index'))

def login():
    return dict(form=auth.login(next='index'))

VIEWS:
register.html

{{extend 'layout.html'}}
<form>
<table>
        <tr>
                <td>User Name:</td>
                <td><input name="user_name" type="text"
value="{{=form.latest.user_name}}"/></td>
        </tr>
        <tr>
                <td>Password:</td>
                <td><input type="password" value="" name="password" 
class="password"/
></td>
        </tr>
        <tr>
        <td>Verify Password:</td>
        <td><input type="password" name="password_two"/></td>
        </tr>
        <tr>
        <td><input type="submit" value="Submit" /></td>
    </tr>
</table>
{{=form.hidden_fields()}}
</form>

login.html

{{extend 'layout.html'}}
<form>
<table>
        <tr>
                <td>User Name:</td>
                <td><input name="user_name" type="text" value=""/></td>
        </tr>
        <tr>
                <td>Password:</td>
                <td><input type="password" value="" name="password" 
class="password"/
></td>
        </tr>
        <tr>
        <td><input type="submit" value="Submit" /></td>
    </tr>
</table>
{{=form.hidden_fields()}}
</form>

Here are the issues that I'm facing:
1) error messages for uniqueness of user name & email are not shown to
front end; is there any other js that I need to include?
2) in login, the password is sent in plain text. how to rectify
3) should the users so registered be inserted into any groups (as part
of auth framework)? If so, do I do this in the register controller
function?

Thank you,
Joseph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to