mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 08:58:30 +01:00
set user_id when creating AliasUsedOn
This commit is contained in:
parent
b655503d39
commit
6976c28985
3 changed files with 6 additions and 4 deletions
|
@ -72,7 +72,7 @@ def new_custom_alias():
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
if hostname:
|
if hostname:
|
||||||
AliasUsedOn.create(alias_id=alias.id, hostname=hostname)
|
AliasUsedOn.create(alias_id=alias.id, hostname=hostname, user_id=alias.user_id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return jsonify(alias=full_alias), 201
|
return jsonify(alias=full_alias), 201
|
||||||
|
|
|
@ -52,7 +52,7 @@ def new_random_alias():
|
||||||
|
|
||||||
hostname = request.args.get("hostname")
|
hostname = request.args.get("hostname")
|
||||||
if hostname:
|
if hostname:
|
||||||
AliasUsedOn.create(alias_id=alias.id, hostname=hostname)
|
AliasUsedOn.create(alias_id=alias.id, hostname=hostname, user_id=alias.user_id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return jsonify(alias=alias.email), 201
|
return jsonify(alias=alias.email), 201
|
||||||
|
|
|
@ -42,7 +42,7 @@ def test_different_scenarios(flask_client):
|
||||||
# <<< with recommendation >>>
|
# <<< with recommendation >>>
|
||||||
alias = Alias.create_new(user, prefix="test")
|
alias = Alias.create_new(user, prefix="test")
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
AliasUsedOn.create(alias_id=alias.id, hostname="www.test.com")
|
AliasUsedOn.create(alias_id=alias.id, hostname="www.test.com", user_id=user.id)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
r = flask_client.get(
|
r = flask_client.get(
|
||||||
|
@ -87,7 +87,9 @@ def test_different_scenarios_v2(flask_client):
|
||||||
# <<< with recommendation >>>
|
# <<< with recommendation >>>
|
||||||
alias = Alias.create_new(user, prefix="test")
|
alias = Alias.create_new(user, prefix="test")
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
AliasUsedOn.create(alias_id=alias.id, hostname="www.test.com")
|
AliasUsedOn.create(
|
||||||
|
alias_id=alias.id, hostname="www.test.com", user_id=alias.user_id
|
||||||
|
)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
r = flask_client.get(
|
r = flask_client.get(
|
||||||
|
|
Loading…
Reference in a new issue