mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Merge pull request #106 from aavenel/bugfix105
Bugfix #105 : TypeError: object of type 'NoneType' has no len()
This commit is contained in:
commit
229fe41a0c
2 changed files with 13 additions and 1 deletions
|
@ -289,6 +289,11 @@ class BudgetTestCase(TestCase):
|
|||
self.assertTrue(models.Project.query.get("demo") is not None)
|
||||
|
||||
def test_authentication(self):
|
||||
# try to authenticate without credentials should redirect
|
||||
# to the authentication page
|
||||
resp = self.app.post("/authenticate")
|
||||
self.assertIn("Authentication", resp.data)
|
||||
|
||||
# raclette that the login / logout process works
|
||||
self.create_project("raclette")
|
||||
|
||||
|
|
|
@ -72,7 +72,14 @@ def authenticate(project_id=None):
|
|||
if not form.id.data and request.args.get('project_id'):
|
||||
form.id.data = request.args['project_id']
|
||||
project_id = form.id.data
|
||||
project = Project.query.get(project_id)
|
||||
if project_id is None:
|
||||
#User doesn't provide project identifier, return to authenticate form
|
||||
msg = _("You need to enter a project identifier")
|
||||
form.errors["id"] = [msg]
|
||||
return render_template("authenticate.html", form=form)
|
||||
else:
|
||||
project = Project.query.get(project_id)
|
||||
|
||||
create_project = False # We don't want to create the project by default
|
||||
if not project:
|
||||
# But if the user try to connect to an unexisting project, we will
|
||||
|
|
Loading…
Add table
Reference in a new issue