Dear users, I'm writing because i have a problem with function login_bare. I'm developing a mobile app and data are shared by json i'm using something like this
response.view = 'generic.json' import gluon.contrib.simplejson, collections json_data = request.body.read() external_data = gluon.contrib.simplejson.loads(json_data) db.auth_user.username.requires = [IS_NOT_EMPTY(error_message=T("xxx")), IS_NOT_IN_DB(db,'auth_user.username',error_message=T('xxx'))] db.auth_user.email.requires = [IS_EMAIL(error_message=T("xxx")), IS_NOT_IN_DB(db,'auth_user.email',error_message=T('xxx'))] db.auth_user.password.requires = [IS_NOT_EMPTY(error_message=T("xxx")), IS_STRONG(min=8,max=30,entropy=1,upper=None,lower=None,special=None,number=None, error_message=xxxi'), IS_EQUAL_TO(external_data['auth_user_rpassword'],error_message=T("xxx"))] ret = db.auth_user.validate_and_insert(username=external_data['auth_user_username'], email=external_data['auth_user_email'], password=external_data['auth_user_password'] ) if(ret.errors): db.rollback() errors = ret.errors.as_dict() errors["tjsondata"] = "error" return gluon.contrib.simplejson.dumps(errors) else: db.commit() return gluon.contrib.simplejson.dumps({"tjsondata":"registered","id":ret.id,"username":external_data['auth_user_username']}) For login i have created this def for testing the function login_bare response.view = 'generic.json' import gluon.contrib.simplejson, collections json_data = request.body.read() external_data = gluon.contrib.simplejson.loads(json_data) user = auth.login_bare(external_data["auth_user_username"],external_data["auth_user_password"]) if not user : return gluon.contrib.simplejson.dumps({"username":""}) else: return gluon.contrib.simplejson.dumps({"username":user}) The function login_bare always returns a empty string but i'm sure about the data i put in table auth_user Why does this happen ? Should i encrypt the password before the insert ? In the row the field password isn't encrypted... Thanks for your answers... -- 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.