Skip to content

Commit

Permalink
[ADD][bio_login]-system parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
SaraiOsorio committed Dec 1, 2017
1 parent 8b71a6d commit 56731ea
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 28 deletions.
1 change: 1 addition & 0 deletions bio_login/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'description': 'Bio Login',
'depends': [],
'data': [
'data/config_parameter_data.xml',
'views/res_user_view.xml',
],
'installable': True,
Expand Down
9 changes: 9 additions & 0 deletions bio_login/data/config_parameter_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="ngrok_url_parameter" model="ir.config_parameter">
<field name="key">ngrok_url</field>
<field name="value">http://0d0b113c.ngrok.io/BioEngineClientWS/BioEngineClient.asmx?WSDL</field>
</record>
</data>
</odoo>
57 changes: 29 additions & 28 deletions bio_login/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,33 @@ def _login(self, db, login, password):
cr.execute("SELECT biokey FROM res_users WHERE id = %s" % (
user_id,))
user_biokey = cr.fetchone()
if not request.session.login:
client = Client(
'http://0d0b113c.ngrok.io/BioEngineClientWS'
'/BioEngineClient.asmx?WSDL')
token = client.service.GetToken()['outToken']
transaction = client.service.GetTmpTransNum(
token)['outTmpTransNum']
client.service.CaptureFinger(
inToken=token,
inTmpTransNum=transaction,
inFlat=True,
inRoll=False,
inThumbR=False,
inIndexR=True,
inMiddleR=False,
inRingR=False,
inLittleR=False,
inThumbL=False,
inIndexL=False,
inMiddleL=False,
inRingL=False,
inLittleL=False,
)
client.service.SendToServer(token, transaction)
biokey = client.service.ServerFind(
transaction, user_biokey[0])['outBioKey']
if not biokey:
user_id = False
if request.session.login:
return user_id
ngrok_url = self.pool.get('ir.config_parameter').get_param(
'ngrok_url_parameter')
client = Client(ngrok_url)
token = client.service.GetToken()['outToken']
transaction = client.service.GetTmpTransNum(
token)['outTmpTransNum']
client.service.CaptureFinger(
inToken=token,
inTmpTransNum=transaction,
inFlat=True,
inRoll=False,
inThumbR=False,
inIndexR=True,
inMiddleR=False,
inRingR=False,
inLittleR=False,
inThumbL=False,
inIndexL=False,
inMiddleL=False,
inRingL=False,
inLittleL=False,
)
client.service.SendToServer(token, transaction)
biokey = client.service.ServerFind(
transaction, user_biokey[0])['outBioKey']
if not biokey:
user_id = False
return user_id

0 comments on commit 56731ea

Please sign in to comment.