So as of now, the user is able to use his unique username to log in, 
instead of email.

On Friday, July 3, 2015 at 12:56:22 PM UTC+5:30, Ramashish Gaurav wrote:
>
> Hello all,
>
> I thank Villas, Anthony and Stiffan, for their interest. I have come up 
> with the solution to my problem. 
>
> I defined a custom registration form, and included 'username' as one of 
> its fields and made it true. And also removed the IS_NOT_IN_DB() constraint 
> from the email field. As of now it works as per my expectation. If some 
> issue occurs, I'll update this post.
>
> Here is my code:
>
> File > db.py
>
> from gluon.tools import Auth, Service, PluginManager
>
> auth = Auth(db)
> service = Service()
> plugins = PluginManager()
>
> #Custom auth_table
> db.define_table(
>     auth.settings.table_user_name,
>     Field('first_name',length=128,default=''),
>     Field('last_name',length=128,default=''),
>     Field('username','string',length=128),
>     Field('email',length=128),
>     Field('password','password'),
>     Field('department','string'),
>     Field('registration_key', length=512,                # required
>           writable=False, readable=False,default=''),
>     Field('reset_password_key', length=512,              # required
>           writable=False, readable=False,default=''),
>     Field('registration_id', length=512,                 # required
>          writable=False, readable=False,default=''))
>
>
> ## create all tables needed by auth if not custom tables
> auth.define_tables(username=True, signature=False)
> custom_auth_table = db[auth.settings.table_user]
> custom_auth_table.username.requires = IS_NOT_IN_DB(db, 
> custom_auth_table.username)
> custom_auth_table.password.requires = [CRYPT()]
> custom_auth_table.email.requires = [
>   IS_EMAIL(error_message=auth.messages.invalid_email)]
>     
>
> Its noteworthy that no " unique=True " is required in username field, but 
> it ensures its uniqueness itself. 
>
> If you have suggestions about this code, or if I am committing a silly 
> mistake, please correct me. 
>
> Regards,
> Ramashish
>
>
>
>
> On Thursday, July 2, 2015 at 9:18:19 PM UTC+5:30, villas wrote:
>>
>> Hi Ramashish
>>
>> Your best option (by far!) is to consider this...
>>
>> Gmail treats all these email addresses as equivalent for delivering 
>> emails:
>>
>>    - a...@gmail.com
>>    - abc+...@gmail.com
>>    - abc+...@gmail.com
>>    - abc+anyth...@gmail.com
>>    
>> The suffix must follow the '+' sign.
>>
>> Use this facility for allowing each user to have his/her own log in. 
>>
>> Regards, D
>>
>>
>>
>>
>>
>>
>>
>> On Thursday, 2 July 2015 11:02:51 UTC+1, Ramashish Gaurav wrote:
>>>
>>> Hello all !
>>>
>>> I need to create a registration form where users can have same email 
>>> ids, but different user id... say for example :
>>>
>>> There are four users A, B, C, and D. There is a common email account 
>>> they share, say "ab...@gmail.com" . Before I explain further, let me 
>>> state that users wouldn't be able to register themselves via the 
>>> application, but the admin of application would create unique user_id's for 
>>> each users from database administration side. So let the users have unique 
>>> user_id's as a123, b123, c123 and d123. 
>>>
>>> Thus they can log in into the application by feeding in their unique 
>>> user_id's and password, and when an email might be needed to send them, I 
>>> would select their name or user_id and send a mail. Thus the mail arrive 
>>> into an account ( "ab...@gmail.com" ) commonly accessed by all of them. 
>>> I guess the changes are to be made in registration form and log in form.
>>>
>>> If there's a way to achieve it, please share it with me. Thanks for your 
>>> interest ! 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to