Skip to content
Open

HW 3 #301

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2f9bedd
Pridedame Secrurity biblioteką
aurelijusb Nov 16, 2019
d22a83b
Pridedam profiler biblioteką puslapio informacijos juostai
aurelijusb Nov 16, 2019
2666d30
Susikuriame naudotojo klasę
aurelijusb Nov 16, 2019
e41da46
Atnaujiname duomenų bazę
aurelijusb Nov 16, 2019
4025599
Prisidedame Validator biblioteką
aurelijusb Nov 16, 2019
138331f
Susikuriame registracijos formą
aurelijusb Nov 16, 2019
270b11b
Sugeneruojame prisjungimo formos pavyzdį
aurelijusb Nov 17, 2019
5361650
Pataisome nukreipimą po prisijungimo
aurelijusb May 6, 2019
cd87b91
Naudotojo objekto pasiekimas iš Twig
aurelijusb May 6, 2019
3a55cff
Naudotojo objekto pasiekimas iš Controller'io
aurelijusb May 6, 2019
d003017
Pridedame EasyAdminBundle biblioteką (receptą)
aurelijusb Nov 17, 2019
afec7c1
Pataisome EasyAdmin konfiguraciją
aurelijusb May 6, 2019
b0801dd
Apribojame Administavimą tik registruotiems naudotojams
aurelijusb May 6, 2019
85be5f1
Sukuriam Console's komandą
aurelijusb Nov 17, 2019
90dd1dc
Įgyvendinam komandą rolei pakelti
aurelijusb May 6, 2019
c28cde1
Praplečiame TwigBundle klaidų šabloną
aurelijusb May 6, 2019
f93981f
Praplečiame EasyAdmin šabloną: Surandame originalų šabloną
aurelijusb May 6, 2019
9eb5935
Praplečiame EasyAdmin šabloną: pakeičiam turinį
aurelijusb Nov 17, 2019
42f5107
Praplečiame EasyAdmin nustatymus: laukų atvaizdavimas
aurelijusb May 6, 2019
98518eb
Registracijos dizainas per konfiguraciją
aurelijusb May 6, 2019
494f71a
Naujų laukų pridėjimas: Papildome Entity (duomenų modelį)
aurelijusb May 6, 2019
04c5115
Naujų laukų pridėjimas: Atnaujiname duomenų bazę
aurelijusb Nov 18, 2019
771d118
Naujų laukų pridėjimas: Papildome formas ir kitus dizaino elementus
aurelijusb May 6, 2019
654c2d0
Po registracijos naudotoją prijungiame automatiškai
aurelijusb May 6, 2019
e330682
Patogumui: Pataisome redagavimą nenurodant slaptažodžio
aurelijusb May 7, 2019
a1befa0
Naujų laukų pridėjimas: Konfiguracija EasyAdminBundle
aurelijusb May 7, 2019
08cbf1b
Sukuriame EventSubscriber pavyzdį
aurelijusb May 7, 2019
1ed3041
Užregistruojame event'ą Symfony karkase
aurelijusb May 7, 2019
2a347c4
Įgyvendiname: slaptažodžio pakeitimo datos laukelį
aurelijusb May 7, 2019
87e504e
Atnaujiname duomenų bazę
aurelijusb Nov 18, 2019
820e8d2
Building project and smoke tests
aurelijusb Nov 10, 2019
dd1556a
Running end to end (Browser) tests
aurelijusb Nov 10, 2019
96d2eb9
Simple tests
aurelijusbanelis Nov 13, 2019
13f5db8
Simple e2e test
aurelijusb Nov 18, 2019
e91e36f
Register new user
aurelijusb Nov 18, 2019
ccf8b96
Add test user to database
aurelijusb Nov 18, 2019
5dbad68
More complex tests
aurelijusb Nov 18, 2019
de5c179
Fix naming
aurelijusb Nov 18, 2019
6afa700
Case insensitive tests
aurelijusb Nov 23, 2019
0848ebc
HOMEWORK 3
Matasj98 Nov 25, 2019
6f09767
confilcts fixed
Matasj98 Dec 11, 2019
9187df8
fix
Matasj98 Dec 11, 2019
81976ec
D
Matasj98 Dec 11, 2019
b40ed09
d
Matasj98 Dec 11, 2019
fda1669
ddda
Matasj98 Dec 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
![](https://avatars0.githubusercontent.com/u/4995607?v=3&s=100)

HOMEWORK 3 COMPLETE and yes, it's in master branch.


NFQ Akademija
============

Expand Down
2 changes: 2 additions & 0 deletions config/packages/easy_admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ easy_admin:
- 'username'
- { property: 'roles', template: 'admin/user/roles-type-read.html.twig' }
- { property: 'homepage', type: 'url' }
- { property: 'linkedin', type: 'url' }
- { property: 'password', template: 'admin/user/password-read.html.twig' }
form:
fields:
- { property: 'email', type: 'email' }
- { property: 'roles', type: 'collection' }
- { property: 'plainPassword', type: 'password' }
- { property: 'homepage', type: 'url' }
- { property: 'linkedin', type: 'url' }

user:
name_property_path: "email"
24 changes: 24 additions & 0 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class User implements UserInterface
*/
private $homepage = "";

/**
* @var null|string Link to linkedin
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $linkedin = "";

public function getId(): ?int
{
return $this->id;
Expand Down Expand Up @@ -187,4 +193,22 @@ public function setHomepage(?string $homepage): self

return $this;
}

/**
* @return string|null
*/
public function getLinkedin(): ?string
{
return $this->linkedin;
}

/**
* @param string|null $linkedin
*/
public function setLinkedin(?string $linkedin): self
{
$this->linkedin = $linkedin;

return $this;
}
}
1 change: 1 addition & 0 deletions src/Form/RegistrationFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
],
])
->add('homepage', UrlType::class, ['required' => false])
->add('linkedin', UrlType::class, ['required' => false])
->add('agreeTerms', CheckboxType::class, [
'mapped' => false,
'constraints' => [
Expand Down
35 changes: 35 additions & 0 deletions src/Migrations/Version20191125144441.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Šis failas nėra būtinas. Nes neprideda jokių laukų
src/Migrations/Version20191125145851.php padengia viską.

Verta mokintis nepalikinėti šiukšlių


declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20191125144441 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}

public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci');
}
}
35 changes: 35 additions & 0 deletions src/Migrations/Version20191125145851.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20191125145851 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}

public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user ADD linkedin VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user DROP linkedin, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci');
}
}
2 changes: 2 additions & 0 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
<li class="nav-item">
<a class="nav-link" href="{{ path('app_logout') }}">Atsijungti</a>
</li>
{% if is_granted('ROLE_ADMIN') %}
<li class="nav-item">
<a class="nav-link" href="{{ path('easyadmin') }}">Administravimas</a>
</li>
{% endif %}

{% else %}

Expand Down
1 change: 1 addition & 0 deletions templates/registration/register.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{{ form_row(registrationForm.email) }}
{{ form_row(registrationForm.plainPassword) }}
{{ form_row(registrationForm.homepage) }}
{{ form_row(registrationForm.linkedin) }}
{{ form_row(registrationForm.agreeTerms) }}

<button class="btn">Register</button>
Expand Down
3 changes: 2 additions & 1 deletion templates/security/profile.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<span class="badge badge-secondary">{{ role|lower }}</span>
{% endfor %}
<div class="mb-2">
<span class="badge badge-primary">Website</span> <a href="{{ user.homepage }}"></a>{{ user.homepage }}
<span class="badge badge-primary">Website</span> <a href="{{ user.homepage }}">{{ user.homepage }} </a><br/>
<span class="badge badge-primary">Linkedin</span> <a href="{{ user.linkedin }}">{{ user.linkedin }}</a>
</div>
</div>
{% endblock %}