Your right: should be:
Controller:
def user_bare():
username, password = request.post_vars['username'],
request.post_vars['password']
if not auth.user:
form = auth.login_bare(username, password)
return dict(form=form)
View:
{{extend 'layout.html'}}
<INPUT type="button" value="HOME"
onclick="location.href='{{=URL('index')}}'"/>
<form enctype="multipart/form-data"
action="{{=URL()}}" method="post"> <!--{{#or use =form.custom.begin}}-->
<div class="form-group">
<input type="text" class="form-control" name="username">
</div>
<div class="form-group">
<input type="password" class="form-control" name="password">
</div>
<button type="submit">
Submit
</button>
</form> <!--{{#or use =form.custom.end}}-->
But now am getting:
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
Traceback (most recent call last):
File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 119, in <module>
File "/data/web2py/web2py/gluon/globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 21, in user_bare
form = auth.login_bare(username, password)
File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
self.login_user(user)
File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
self.update_groups()
File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
table_membership.user_id == self.user.id).select()
File
"/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
line 109, in __getattr__
raise AttributeError
AttributeError
Error snapshot [image: help]
<https://10.13.70.47/admin/default/ticket/Mec/10.13.69.144.2018-12-11.12-51-58.8ec7b7f4-643a-4ea2-b28d-0f5b5364bf57#>
With session.auth showing the correct user record.
But should NOT login_bare bypass all the checking of auth_membership,
groups , etc ?
ie:
Frames
-
*File /data/web2py/web2py/gluon/restricted.py in restricted at line 219*
code arguments variables
-
*File /data/web2py/web2py/applications/Mec/controllers/default.py in
<module> at line 119* code arguments variables
-
*File /data/web2py/web2py/gluon/globals.py in <lambda> at line 421* code
arguments variables
-
*File /data/web2py/web2py/applications/Mec/controllers/default.py in
user_bare at line 21* code arguments variables
-
*File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283* code
arguments variables
-
*File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
code arguments variables
-
*File /data/web2py/web2py/gluon/authapi.py in update_groups at line 503*
code arguments variables
-
*File
/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
in __getattr__ at line 109* code arguments variables
Function argument list
(self=<Row {'ap_allowed': False, 'iv_allowed': False, ...ress_2': None,
'address_3': None, 'notes': None}>, k='id')
Code listing
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
def __getattr__(self, k):
try:
return self.__getitem__(k)
except KeyError:
raise AttributeError
def __copy__(self):
return Row(self)
Thanks ...
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division
On Tue, Dec 11, 2018 at 11:19 AM Yoel Benitez Fonseca <[email protected]>
wrote:
> probably abastardi wants:
>
> username, password = request.post_vars['username'],
> request.post_vars['password']
> if not auth.user:
> auth.login_bare(username, password)
>
>
> What is that's for ... i can only guest...
>
>
> On Dec 11 2018, at 11:58 am, Anthony <[email protected]> wrote:
>
>
> What is the point of calling login_bare a second time after it has failed
> the first time?
>
>
> What I click to fire off the "bare login" all I get is an empty web page
>
> that says "None"
>
>
> Presumably your controller is returning None, but hard to say what's
> happening without the code.
>
> Anthony
>
> --
> 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.
>
> [image: Open Tracking]
>
> --
> 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.