add example for testing
This commit is contained in:
parent
f1541c7d7d
commit
bc2b146f79
@ -20,11 +20,20 @@ def gen():
|
||||
#content = Markup('<strong>The HTML String</strong>')
|
||||
user_id = request.args.get('user_id')
|
||||
print(user_id)
|
||||
auth_dict[int(user_id)] = ''
|
||||
content = '''
|
||||
print(request.args.get('mode'))
|
||||
if request.args.get('mode') == 'generated':
|
||||
auth_dict.update({int(user_id):''})
|
||||
content = '''
|
||||
<p style="text-align: center;">Your passphrase for <strong>''' + str(user_id) + '''</strong>:</p>
|
||||
<p style="text-align: center;"><strong>''' + str(gen_passphrase(int(user_id))) + '''</strong></p>
|
||||
'''
|
||||
if request.args.get('mode') == 'legacy':
|
||||
auth_dict.update({int(user_id):0})
|
||||
content = '''<p style="text-align: center;">Using legacy auth</p>'''
|
||||
if request.args.get('mode') == 'custom':
|
||||
auth_dict.update({int(user_id):str(request.args.get('custom'))})
|
||||
content = '''<p style="text-align: center;">Using custom auth passphrase: ''' + request.args.get('custom') + '''</p>'''
|
||||
|
||||
print(auth_dict)
|
||||
|
||||
|
||||
@ -36,31 +45,40 @@ def gen():
|
||||
def index():
|
||||
#content = Markup('<strong>The HTML String</strong>')
|
||||
content = '''
|
||||
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><form action="gen" method="get">
|
||||
<table style="margin-left: auto; margin-right: auto;">
|
||||
<tbody>
|
||||
<tr style="height: 62px;">
|
||||
<td style="text-align: center; height: 62px;">
|
||||
<h2><strong><label for="user_id">Generate Passphrase</label></strong></h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px;"><input id="user_id" name="user_id" type="text" /></td>
|
||||
</tr>
|
||||
<tr style="height: 27px;">
|
||||
<td style="text-align: center; height: 27px;"><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form></td>
|
||||
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><form action="gen" method="get">
|
||||
<table style="margin-left: auto; margin-right: auto;">
|
||||
<tbody>
|
||||
<tr style="height: 62px;">
|
||||
<td style="text-align: center; height: 62px;">
|
||||
<h2><strong><label for="user_id">DMR ID</label></strong></h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px; text-align: center;"><input id="user_id" name="user_id" type="text" /></td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px; text-align: center;"><select name="mode">
|
||||
<option selected="selected" value="generated">Generated Passphrase</option>
|
||||
<option value="legacy">Legacy</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px;">Custom Password (only use if custom is selected): <input id="custom" name="custom" type="text" /></td>
|
||||
</tr>
|
||||
<tr style="height: 27px;">
|
||||
<td style="text-align: center; height: 27px;"><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
'''
|
||||
|
||||
|
||||
@ -70,6 +88,7 @@ def index():
|
||||
def auth():
|
||||
hblink_req = request.json
|
||||
print((hblink_req))
|
||||
print(auth_dict)
|
||||
if hblink_req['secret'] in shared_secrets:
|
||||
if hblink_req['id'] in auth_dict:
|
||||
if auth_dict[hblink_req['id']] == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user