mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Validate authentication form if given identifier is null. Fix #30.
This commit is contained in:
parent
b0d41291af
commit
34ccb3546d
1 changed files with 6 additions and 2 deletions
|
@ -63,7 +63,7 @@ def pull_project(endpoint, values):
|
||||||
def authenticate(project_id=None):
|
def authenticate(project_id=None):
|
||||||
"""Authentication form"""
|
"""Authentication form"""
|
||||||
form = AuthenticationForm()
|
form = AuthenticationForm()
|
||||||
if not form.id.data and request.args['project_id']:
|
if not form.id.data and request.args.get('project_id'):
|
||||||
form.id.data = request.args['project_id']
|
form.id.data = request.args['project_id']
|
||||||
project_id = form.id.data
|
project_id = form.id.data
|
||||||
project = Project.query.get(project_id)
|
project = Project.query.get(project_id)
|
||||||
|
@ -71,7 +71,11 @@ def authenticate(project_id=None):
|
||||||
if not project:
|
if not project:
|
||||||
# But if the user try to connect to an unexisting project, we will
|
# But if the user try to connect to an unexisting project, we will
|
||||||
# propose him a link to the creation form.
|
# propose him a link to the creation form.
|
||||||
create_project = project_id
|
if not project_id:
|
||||||
|
if request.method == "POST":
|
||||||
|
form.validate()
|
||||||
|
else:
|
||||||
|
create_project = project_id
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# if credentials are already in session, redirect
|
# if credentials are already in session, redirect
|
||||||
|
|
Loading…
Reference in a new issue