It's what I'm using right now (I can log with users from both servers) but 
I use the same credentials to process the queries that gather datas for my 
app (list of users, list of computers,...) and I need to know on which 
server the user is authenticated to in order to use the correct information 
for my queries.
I'm seeing 2 ways: 
- automatically determine which ldap_auth was successful (I posted a 
question on the group for this as I linked before in this thread)
- let the user decide and try auth only on the server the user chose.

but I can't get any of these to work.

On Wednesday, December 9, 2015 at 11:49:32 AM UTC-5, Richard wrote:
>
> What about setting 2 ldap authentication ?
>
> In web2py you can login with multiple login methods and web2py use them in 
> the order they are specified in auth.settings.login_methods... If password 
> fail for one it tries with the other...
>
> Here my settings :
> auth.settings.login_methods = \
>     [auth,
>      ldap_auth(...)]
>
> You may try just to do :
> auth.settings.login_methods = \
>     [ldap_auth(...),
>      ldap_auth(...)]
>
> You define you 2 differents ldap servers...
>
> Richard
>
>
>
> On Tue, Dec 8, 2015 at 4:19 PM, Jonathan R <[email protected] <javascript:>> 
> wrote:
>
>> I have two distinct sources of authentication ( 2 ldap servers) and I use 
>> the credentials provided by the user to perform the query that gather 
>> information on the ldap server on which the user is authenticated.
>> In an effort to follow the DRY concept my function that gather 
>> information can query both server and chose the correct one by using a 
>> boolean set to True for one server and False for the other. 
>> I asked another question on this group about the best way to determine 
>> which auth_method was successful (when using 
>> auth.settings.auth_methods[auth_ldap(server 1), auth_ldap(server2)]) but no 
>> one has provided an answer yet. 
>> That let me with the present option to customize the login form to let 
>> the user chose on which server launch the query.
>>
>> I asked about the variable storing the value before processing the form 
>> because I was exploring on the jQuery side ( onchange event) which doesn't 
>> seems to be able to do the job.
>>
>> I hope I clarified the situation :p
>>  
>> On Tuesday, December 8, 2015 at 3:18:04 PM UTC-5, Richard wrote:
>>>
>>> :)
>>>
>>> For what...
>>>
>>>
>>>
>>> On Tue, Dec 8, 2015 at 2:18 PM, Jonathan R <[email protected]> wrote:
>>>
>>>> I need to have this radio button, 
>>>> is there a variable that stores the value of the radio button before 
>>>> processing the form ? 
>>>>
>>>> On Tuesday, December 8, 2015 at 11:03:40 AM UTC-5, Richard wrote:
>>>>>
>>>>> You should have a look at web2py auth... I guess no one really need to 
>>>>> customize login form... There is surely a way to customize it, and you 
>>>>> seems to have found a way... You may also, ask yourself about why you do 
>>>>> that and if you really need to do it... Or could it be crafted 
>>>>> differently... For instance would your user really want to change setting 
>>>>> at each login?? Maybe you can have a preference profile page for each 
>>>>> user 
>>>>> to them set there prefered way of login...
>>>>>
>>>>> Richard
>>>>>
>>>>> On Tue, Dec 8, 2015 at 10:56 AM, Jonathan R <[email protected]> wrote:
>>>>>
>>>>>> Yes I did, and nothing changed on the login screen, I still had None 
>>>>>> displayed instead of the radio button.
>>>>>>
>>>>>> I feel like there is a simple easy way to add a field in the login 
>>>>>> screen and save it but I can't see it...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Monday, December 7, 2015 at 9:42:51 PM UTC-5, Richard wrote:
>>>>>>>
>>>>>>> Did you try by simply specify :
>>>>>>>>
>>>>>>>> Field('radio_button', ..., readable=True, writable=True)
>>>>>>>>
>>>>>>>
>>>>>>> ?
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>> On Mon, Dec 7, 2015 at 5:19 PM, Jonathan R <[email protected]> wrote:
>>>>>>>
>>>>>>>> I successfully added the radio button i wanted on my login page but 
>>>>>>>> instead of using a column in the auth_user table I only created a 
>>>>>>>> radio 
>>>>>>>> button that will assign its value in a session variable. To do so I 
>>>>>>>> need to 
>>>>>>>> modify the if form.accepts(): block to gather the value on submission 
>>>>>>>> but 
>>>>>>>> I'm not sure where to find this piece of code (or what should be in a 
>>>>>>>> custom one to keep the authentication process working).
>>>>>>>>
>>>>>>>> my default.py :
>>>>>>>> user():
>>>>>>>>
>>>>>>>> if request.args(0)== "login":
>>>>>>>>     form=auth()
>>>>>>>>     form.elements()[0].insert(0,LABEL('text1',_class='radioButton'))
>>>>>>>>     
>>>>>>>> form.elements()[0].insert(0,INPUT(_type='radio',_class='radioButton',_value='text1'))
>>>>>>>>     #same for all values 
>>>>>>>>
>>>>>>>>     #frest of the form (username and password) same as Richard 
>>>>>>>> implementation
>>>>>>>>     
>>>>>>>>     return dict(form=form)
>>>>>>>>
>>>>>>>> [...]
>>>>>>>>
>>>>>>>> then if I want to gather the data in a session variable I'll have 
>>>>>>>> to change the behavior of the auth() form on accepts:
>>>>>>>>
>>>>>>>> if form.accepts(request,session):
>>>>>>>>     session.radioButtonValue = form.vars.radioButton    
>>>>>>>>     
>>>>>>>> but this will stop the auth to process the rest of the form but I 
>>>>>>>> don't know what are the mandatory steps to add (couldn't locate the 
>>>>>>>> original auth accepts process)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Friday, December 4, 2015 at 4:45:52 PM UTC-5, Jonathan R wrote:
>>>>>>>>>
>>>>>>>>> Hi everyone,
>>>>>>>>> I'm trying to add a radio button on my login form to let the user 
>>>>>>>>> decide which authentication method he wants to use.
>>>>>>>>>
>>>>>>>>> I added a field in the auth_user table and i try to display the 
>>>>>>>>> corresponding radio button in my login page as follow:
>>>>>>>>>
>>>>>>>>> in bd.py
>>>>>>>>>
>>>>>>>>> [......]
>>>>>>>>>
>>>>>>>>> auth.settings.extra_fields['auth_user']=[Field]('choice', 
>>>>>>>>> requires=IS_IN_SET(['choice 1','choice 
>>>>>>>>> 2']),widget=SQLFORM.widgets.radio.widget),]
>>>>>>>>>
>>>>>>>>> auth.define_tables(username=True)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>>>
>>>>>>>>> in user.html    
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>>>
>>>>>>>>> {{form=auth.login()}}
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>>>
>>>>>>>>> {{=form.custom.begin}} 
>>>>>>>>> Method to Use:
>>>>>>>>> {{=form.custom.widget.choice}}
>>>>>>>>> </br>
>>>>>>>>> Username:
>>>>>>>>> {{=form.custom.widget.username}}
>>>>>>>>> </br>
>>>>>>>>> Password:
>>>>>>>>> {{=form.custom.widget.password}}
>>>>>>>>> {{=form.custom.submit}} 
>>>>>>>>> {{=form.custom.end}} 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>>>
>>>>>>>>> This displays correctly the Username and password fields as text 
>>>>>>>>> and password field but instead of the radio Button the app return 
>>>>>>>>> None.
>>>>>>>>>
>>>>>>>>> I checked the db table and the field is created.
>>>>>>>>>
>>>>>>>>> What am I doing wrong ?
>>>>>>>>>
>>>>>>>>> Thank you for your help.
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>> 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 [email protected].
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>> 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 [email protected].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> -- 
>>>> 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 [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to