payload: {"action":"created","comment":{"url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/comments/310391236","pull_request_review_id":270500849,"id":310391236,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMxMDM5MTIzNg==","diff_hunk":"@@ -1,73 +1,80 @@\n from flask import Blueprint, render_template, request, redirect, url_for, flash, abort, current_app\n-# from wtforms import Form, BooleanField, StringField, PasswordField, validators\n+from wtforms import Form, BooleanField, StringField, PasswordField, IntegerField, validators\n from flask_login import current_user\n import db_funkce\n \n \n+class RegistrationForm(Form):\n+    username = StringField(\n+        'Jméno*:', [validators.Required(message='Bez jména to nepůjde.')])\n+    surname = StringField(\n+        'Příjmení*:', [validators.Required(message='Bez příjmení to nepůjde.')])\n+    street = StringField('Ulice,č.p./č.o.:')\n+    city = StringField(\n+        'Město/Obec*:', [validators.Required(message='Vyplň město, kde bydlíš.')])\n+    postcode = IntegerField('PSČ*:', [validators.Required(message='Bez PSČ to nepůjde.'),\n+                                      validators.Length(min=5, max=5, message='PSČ zadej bez mezer.')])\n+    email = StringField('E-mail*:', [validators.Required(message='Bez mailu to nepůjde.', ),\n+                                     validators.Email(message='Chybný tvar emailové adresy.'), validators.Length(min=4, max=40)])\n+    phone = IntegerField('Telefon*:', [validators.Required(message='Bez telefonního čísla to nepůjde.'), validators.Length(\n+        min=11, max=11, message='Telefonní číslo zadej bez předvolby a ve tvaru xxx xxx xxx.')])\n+    password = PasswordField('Heslo*:', [validators.Required(message='Bez hesla to nepůjde.'), validators.EqualTo(\n+        'confirm_password', message='Hesla se musejí shodovat.'), validators.Length(min=8, max=20, message='Heslo musí být alespoň 6 znaků dlouhé.')])\n+    confirm_password = PasswordField(\n+        'Potvrzení hesla*:', [validators.Required(message='Zadané heslo je třeba potvrdit.')])\n+    gdpr = BooleanField('Souhlasím ze zpracováním osobních údajů.*', [validators.Required(\n+        message='Bez udělení Tvého souhlasu Tě nemůžeme zaregistrovat.')])\n+\n+\n blueprint = Blueprint('registrace_bp', __name__)\n+\n+\n @blueprint.route('/registrace')\n def show_registrace():\n-\tzavody = db_funkce.zavody()\n-\tuzivatel = current_user\n-\tif uzivatel.is_authenticated:\n-\t\tflash ('Už jsi přihlášen.', \"danger\")\n-\t\treturn render_template ('zavody.html',  zavody=zavody, id_vybraneho=0)\n-\treturn render_template('registrace.html', values={})\n+    zavody = db_funkce.zavody()\n+    uzivatel = current_user\n+    form = RegistrationForm()\n \n-@blueprint.route('/registrace', methods=['POST'])\n+    if uzivatel.is_authenticated:\n+        flash('Už jsi přihlášen.', \"danger\")\n+        return render_template('zavody.html',  zavody=zavody, id_vybraneho=0)\n+    return render_template('registrace.html', values={}, form=form)\n+\n+\n+@blueprint.route('/registrace', methods=['POST', 'GET'])\n def add_new():\n-\tresult = request.form\n-\tchyba = None\n+    result = request.form\n+    chyba = None\n+    form = RegistrationForm()\n \n-\tuz_registrovany = db_funkce.najdi_uzivatele(result.get(\"email\"))\n-\tif uz_registrovany:\n-\t\tflash ('Už jsi u nás byl/a, tak se prosím přihlaš.', \"danger\")\n-\t\treturn redirect(url_for('prihlaseni_bp.login'))\n+    if form.validate_to_submit():\n+        uz_registrovany = db_funkce.najdi_uzivatele(result.get(\"email\"))\n+        if uz_registrovany:\n+            flash('Už jsi u nás byl/a, tak se prosím přihlaš.', \"danger\")\n+            return redirect(url_for('prihlaseni_bp.login'))\n \n-\theslo = result.get(\"heslo\")\n-\theslo_potvrzeni = result.get(\"heslo_potvrzeni\")\n-\tif not heslo == heslo_potvrzeni:\n-\t\tflash ('Hesla se neshodují.', \"danger\")\n-\t\treturn render_template(\"registrace.html\", values=result, error=chyba)\n-\t\n-\tif not result.get(\"skrtatko\", \"\") == \"ano\":\n-\t\tflash ('Prosím, potvrď souhlas se zpracováním osobních údajů.', \"danger\")\n-\t\treturn render_template(\"registrace.html\", values=result, error=chyba)\n-\t\n-\tid_uzivatele = db_funkce.registrace(\n-\t\tresult.get(\"jmeno\"),\n-\t\tresult.get(\"prijmeni\"),\n-\t\tresult.get(\"ulice\"),\n-\t\tresult.get(\"mesto\"),\n-\t\tresult.get(\"psc\"),\n-\t\tresult.get(\"email\"),\n-\t\tresult.get(\"telefon\"),\n-\t\theslo,\n-\t\theslo_potvrzeni\n-\t)\n-\t\t# Stačí se jen přihlásit <a class=\"odkaz\" href=\"{{ url_for('prihlaseni_bp.login') }}\">tady.</a>'\n-\t\t# return redirect(url_for('prihlaseni_bp.login'))\n+            heslo = result.get(\"heslo\")","path":"registrace_bp.py","position":93,"original_position":93,"commit_id":"293996c8f15a8e7b9f74c8099f5253f75395a4c7","original_commit_id":"293996c8f15a8e7b9f74c8099f5253f75395a4c7","user":{"login":"danvratil","id":932001,"node_id":"MDQ6VXNlcjkzMjAwMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/932001?v=4","gravatar_id":"","url":"https://api.github.com/users/danvratil","html_url":"https://github.com/danvratil","followers_url":"https://api.github.com/users/danvratil/followers","following_url":"https://api.github.com/users/danvratil/following{/other_user}","gists_url":"https://api.github.com/users/danvratil/gists{/gist_id}","starred_url":"https://api.github.com/users/danvratil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danvratil/subscriptions","organizations_url":"https://api.github.com/users/danvratil/orgs","repos_url":"https://api.github.com/users/danvratil/repos","events_url":"https://api.github.com/users/danvratil/events{/privacy}","received_events_url":"https://api.github.com/users/danvratil/received_events","type":"User","site_admin":false},"body":"Špatné odsazení: tohle už by nemělo patřít pod ten `if uz_registrovany`","created_at":"2019-08-04T15:05:28Z","updated_at":"2019-08-04T15:08:20Z","html_url":"https://github.com/Ivuska/bezcisobe/pull/40#discussion_r310391236","pull_request_url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/comments/310391236"},"html":{"href":"https://github.com/Ivuska/bezcisobe/pull/40#discussion_r310391236"},"pull_request":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40","id":304071939,"node_id":"MDExOlB1bGxSZXF1ZXN0MzA0MDcxOTM5","html_url":"https://github.com/Ivuska/bezcisobe/pull/40","diff_url":"https://github.com/Ivuska/bezcisobe/pull/40.diff","patch_url":"https://github.com/Ivuska/bezcisobe/pull/40.patch","issue_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues/40","number":40,"state":"open","locked":false,"title":"Validation of the fields","user":{"login":"Ivuska","id":44750700,"node_id":"MDQ6VXNlcjQ0NzUwNzAw","avatar_url":"https://avatars1.githubusercontent.com/u/44750700?v=4","gravatar_id":"","url":"https://api.github.com/users/Ivuska","html_url":"https://github.com/Ivuska","followers_url":"https://api.github.com/users/Ivuska/followers","following_url":"https://api.github.com/users/Ivuska/following{/other_user}","gists_url":"https://api.github.com/users/Ivuska/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivuska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivuska/subscriptions","organizations_url":"https://api.github.com/users/Ivuska/orgs","repos_url":"https://api.github.com/users/Ivuska/repos","events_url":"https://api.github.com/users/Ivuska/events{/privacy}","received_events_url":"https://api.github.com/users/Ivuska/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-08-04T14:31:49Z","updated_at":"2019-08-04T15:08:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7c79ec264866bf5bf8fae5762279bd28236c89b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40/commits","review_comments_url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40/comments","review_comment_url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues/40/comments","statuses_url":"https://api.github.com/repos/Ivuska/bezcisobe/statuses/293996c8f15a8e7b9f74c8099f5253f75395a4c7","head":{"label":"Ivuska:validation_of_the_fields","ref":"validation_of_the_fields","sha":"293996c8f15a8e7b9f74c8099f5253f75395a4c7","user":{"login":"Ivuska","id":44750700,"node_id":"MDQ6VXNlcjQ0NzUwNzAw","avatar_url":"https://avatars1.githubusercontent.com/u/44750700?v=4","gravatar_id":"","url":"https://api.github.com/users/Ivuska","html_url":"https://github.com/Ivuska","followers_url":"https://api.github.com/users/Ivuska/followers","following_url":"https://api.github.com/users/Ivuska/following{/other_user}","gists_url":"https://api.github.com/users/Ivuska/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivuska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivuska/subscriptions","organizations_url":"https://api.github.com/users/Ivuska/orgs","repos_url":"https://api.github.com/users/Ivuska/repos","events_url":"https://api.github.com/users/Ivuska/events{/privacy}","received_events_url":"https://api.github.com/users/Ivuska/received_events","type":"User","site_admin":false},"repo":{"id":156967204,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY5NjcyMDQ=","name":"bezcisobe","full_name":"Ivuska/bezcisobe","private":false,"owner":{"login":"Ivuska","id":44750700,"node_id":"MDQ6VXNlcjQ0NzUwNzAw","avatar_url":"https://avatars1.githubusercontent.com/u/44750700?v=4","gravatar_id":"","url":"https://api.github.com/users/Ivuska","html_url":"https://github.com/Ivuska","followers_url":"https://api.github.com/users/Ivuska/followers","following_url":"https://api.github.com/users/Ivuska/following{/other_user}","gists_url":"https://api.github.com/users/Ivuska/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivuska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivuska/subscriptions","organizations_url":"https://api.github.com/users/Ivuska/orgs","repos_url":"https://api.github.com/users/Ivuska/repos","events_url":"https://api.github.com/users/Ivuska/events{/privacy}","received_events_url":"https://api.github.com/users/Ivuska/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ivuska/bezcisobe","description":null,"fork":false,"url":"https://api.github.com/repos/Ivuska/bezcisobe","forks_url":"https://api.github.com/repos/Ivuska/bezcisobe/forks","keys_url":"https://api.github.com/repos/Ivuska/bezcisobe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ivuska/bezcisobe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ivuska/bezcisobe/teams","hooks_url":"https://api.github.com/repos/Ivuska/bezcisobe/hooks","issue_events_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues/events{/number}","events_url":"https://api.github.com/repos/Ivuska/bezcisobe/events","assignees_url":"https://api.github.com/repos/Ivuska/bezcisobe/assignees{/user}","branches_url":"https://api.github.com/repos/Ivuska/bezcisobe/branches{/branch}","tags_url":"https://api.github.com/repos/Ivuska/bezcisobe/tags","blobs_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ivuska/bezcisobe/statuses/{sha}","languages_url":"https://api.github.com/repos/Ivuska/bezcisobe/languages","stargazers_url":"https://api.github.com/repos/Ivuska/bezcisobe/stargazers","contributors_url":"https://api.github.com/repos/Ivuska/bezcisobe/contributors","subscribers_url":"https://api.github.com/repos/Ivuska/bezcisobe/subscribers","subscription_url":"https://api.github.com/repos/Ivuska/bezcisobe/subscription","commits_url":"https://api.github.com/repos/Ivuska/bezcisobe/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ivuska/bezcisobe/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ivuska/bezcisobe/contents/{+path}","compare_url":"https://api.github.com/repos/Ivuska/bezcisobe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ivuska/bezcisobe/merges","archive_url":"https://api.github.com/repos/Ivuska/bezcisobe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ivuska/bezcisobe/downloads","issues_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues{/number}","pulls_url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls{/number}","milestones_url":"https://api.github.com/repos/Ivuska/bezcisobe/milestones{/number}","notifications_url":"https://api.github.com/repos/Ivuska/bezcisobe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ivuska/bezcisobe/labels{/name}","releases_url":"https://api.github.com/repos/Ivuska/bezcisobe/releases{/id}","deployments_url":"https://api.github.com/repos/Ivuska/bezcisobe/deployments","created_at":"2018-11-10T09:38:26Z","updated_at":"2019-07-31T16:47:47Z","pushed_at":"2019-08-04T14:31:50Z","git_url":"git://github.com/Ivuska/bezcisobe.git","ssh_url":"git@github.com:Ivuska/bezcisobe.git","clone_url":"https://github.com/Ivuska/bezcisobe.git","svn_url":"https://github.com/Ivuska/bezcisobe","homepage":null,"size":10625,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":29,"license":null,"forks":1,"open_issues":29,"watchers":1,"default_branch":"master"}},"base":{"label":"Ivuska:master","ref":"master","sha":"18bc8edb53e666a5762a605066e958a39a396543","user":{"login":"Ivuska","id":44750700,"node_id":"MDQ6VXNlcjQ0NzUwNzAw","avatar_url":"https://avatars1.githubusercontent.com/u/44750700?v=4","gravatar_id":"","url":"https://api.github.com/users/Ivuska","html_url":"https://github.com/Ivuska","followers_url":"https://api.github.com/users/Ivuska/followers","following_url":"https://api.github.com/users/Ivuska/following{/other_user}","gists_url":"https://api.github.com/users/Ivuska/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivuska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivuska/subscriptions","organizations_url":"https://api.github.com/users/Ivuska/orgs","repos_url":"https://api.github.com/users/Ivuska/repos","events_url":"https://api.github.com/users/Ivuska/events{/privacy}","received_events_url":"https://api.github.com/users/Ivuska/received_events","type":"User","site_admin":false},"repo":{"id":156967204,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY5NjcyMDQ=","name":"bezcisobe","full_name":"Ivuska/bezcisobe","private":false,"owner":{"login":"Ivuska","id":44750700,"node_id":"MDQ6VXNlcjQ0NzUwNzAw","avatar_url":"https://avatars1.githubusercontent.com/u/44750700?v=4","gravatar_id":"","url":"https://api.github.com/users/Ivuska","html_url":"https://github.com/Ivuska","followers_url":"https://api.github.com/users/Ivuska/followers","following_url":"https://api.github.com/users/Ivuska/following{/other_user}","gists_url":"https://api.github.com/users/Ivuska/gists{/gist_id}","starred_url":"https://api.github.com/users/Ivuska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ivuska/subscriptions","organizations_url":"https://api.github.com/users/Ivuska/orgs","repos_url":"https://api.github.com/users/Ivuska/repos","events_url":"https://api.github.com/users/Ivuska/events{/privacy}","received_events_url":"https://api.github.com/users/Ivuska/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ivuska/bezcisobe","description":null,"fork":false,"url":"https://api.github.com/repos/Ivuska/bezcisobe","forks_url":"https://api.github.com/repos/Ivuska/bezcisobe/forks","keys_url":"https://api.github.com/repos/Ivuska/bezcisobe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ivuska/bezcisobe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ivuska/bezcisobe/teams","hooks_url":"https://api.github.com/repos/Ivuska/bezcisobe/hooks","issue_events_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues/events{/number}","events_url":"https://api.github.com/repos/Ivuska/bezcisobe/events","assignees_url":"https://api.github.com/repos/Ivuska/bezcisobe/assignees{/user}","branches_url":"https://api.github.com/repos/Ivuska/bezcisobe/branches{/branch}","tags_url":"https://api.github.com/repos/Ivuska/bezcisobe/tags","blobs_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ivuska/bezcisobe/statuses/{sha}","languages_url":"https://api.github.com/repos/Ivuska/bezcisobe/languages","stargazers_url":"https://api.github.com/repos/Ivuska/bezcisobe/stargazers","contributors_url":"https://api.github.com/repos/Ivuska/bezcisobe/contributors","subscribers_url":"https://api.github.com/repos/Ivuska/bezcisobe/subscribers","subscription_url":"https://api.github.com/repos/Ivuska/bezcisobe/subscription","commits_url":"https://api.github.com/repos/Ivuska/bezcisobe/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ivuska/bezcisobe/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ivuska/bezcisobe/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ivuska/bezcisobe/contents/{+path}","compare_url":"https://api.github.com/repos/Ivuska/bezcisobe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ivuska/bezcisobe/merges","archive_url":"https://api.github.com/repos/Ivuska/bezcisobe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ivuska/bezcisobe/downloads","issues_url":"https://api.github.com/repos/Ivuska/bezcisobe/issues{/number}","pulls_url":"https://api.github.com/repos/Ivuska/bezcisobe/pulls{/number}","milestones_url":"https://api.github.com/repos/Ivuska/bezcisobe/milestones{/number}","notifications_url":"https://api.github.com/repos/Ivuska/bezcisobe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ivuska/bezcisobe/labels{/name}","releases_url":"https://api.github.com/repos/Ivuska/bezcisobe/releases{/id}","deployments_url":"https://api.github.com/repos/Ivuska/bezcisobe/deployments","created_at":"2018-11-10T09:38:26Z","updated_at":"2019-07-31T16:47:47Z","pushed_at":"2019-08-04T14:31:50Z","git_url":"git://github.com/Ivuska/bezcisobe.git","ssh_url":"git@github.com:Ivuska/bezcisobe.git","clone_url":"https://github.com/Ivuska/bezcisobe.git","svn_url":"https://github.com/Ivuska/bezcisobe","homepage":null,"size":10625,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":29,"license":null,"forks":1,"open_issues":29,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40"},"html":{"href":"https://github.com/Ivuska/bezcisobe/pull/40"},"issue":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/issues/40"},"comments":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/Ivuska/bezcisobe/statuses/293996c8f15a8e7b9f74c8099f5253f75395a4c7"}},"author_association":"OWNER"}}
other: {"actor":{"display_login":"danvratil"}}