Compare commits
2 commits
ecb06e812d
...
5e07b3b7dd
Author | SHA1 | Date | |
---|---|---|---|
5e07b3b7dd | |||
6da747d632 |
2 changed files with 19 additions and 3 deletions
|
@ -5,6 +5,7 @@ import flask_sqlalchemy
|
||||||
import flask_praetorian
|
import flask_praetorian
|
||||||
import flask_cors
|
import flask_cors
|
||||||
import sys
|
import sys
|
||||||
|
from password_util import get_random_password
|
||||||
|
|
||||||
db = flask_sqlalchemy.SQLAlchemy()
|
db = flask_sqlalchemy.SQLAlchemy()
|
||||||
guard = flask_praetorian.Praetorian()
|
guard = flask_praetorian.Praetorian()
|
||||||
|
@ -131,6 +132,12 @@ def protected():
|
||||||
"""
|
"""
|
||||||
return {'message': f'protected endpoint (allowed user {flask_praetorian.current_user().username})'}
|
return {'message': f'protected endpoint (allowed user {flask_praetorian.current_user().username})'}
|
||||||
|
|
||||||
|
@app.route('/api/protected/rcv_pw', methods=['GET'])
|
||||||
|
# @flask_praetorian.auth_required
|
||||||
|
def get_password():
|
||||||
|
pw = get_random_password()
|
||||||
|
print(pw)
|
||||||
|
return pw
|
||||||
|
|
||||||
@app.route('/api/register', methods=['POST'])
|
@app.route('/api/register', methods=['POST'])
|
||||||
def register():
|
def register():
|
||||||
|
|
|
@ -9,7 +9,8 @@ def get_random_value(list_length):
|
||||||
random_select = randint(0, list_length)
|
random_select = randint(0, list_length)
|
||||||
return random_select
|
return random_select
|
||||||
|
|
||||||
def get_password():
|
|
||||||
|
def get_random_password():
|
||||||
|
|
||||||
first_part = [
|
first_part = [
|
||||||
"Der Vogel",
|
"Der Vogel",
|
||||||
|
@ -17,12 +18,19 @@ def get_password():
|
||||||
"Die Biene",
|
"Die Biene",
|
||||||
"Ein Mensch",
|
"Ein Mensch",
|
||||||
"Jemand",
|
"Jemand",
|
||||||
|
"Der Hund",
|
||||||
|
"Der Kater",
|
||||||
]
|
]
|
||||||
|
|
||||||
second_part = [
|
second_part = [
|
||||||
"frisst",
|
"frisst",
|
||||||
"küsst",
|
"küsst",
|
||||||
"begrüsst",
|
"begrüsst",
|
||||||
|
"besucht",
|
||||||
|
"beeinflusst",
|
||||||
|
"isst",
|
||||||
|
"findet",
|
||||||
|
"vergisst",
|
||||||
]
|
]
|
||||||
|
|
||||||
third_part = [
|
third_part = [
|
||||||
|
@ -40,6 +48,7 @@ def get_password():
|
||||||
"auf der Wiese.",
|
"auf der Wiese.",
|
||||||
"im Garten.",
|
"im Garten.",
|
||||||
"in der Kühltruhe.",
|
"in der Kühltruhe.",
|
||||||
|
"auf dem Balkon.",
|
||||||
]
|
]
|
||||||
|
|
||||||
password = ""
|
password = ""
|
||||||
|
|
Loading…
Reference in a new issue