move some files to UserBundle

This commit is contained in:
Nicolas Lœuillet 2015-10-03 06:29:55 +02:00 committed by Jeremy Benoist
parent 1210dae105
commit 0a878469d4
15 changed files with 267 additions and 16 deletions

View file

@ -15,16 +15,6 @@ doc-api:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
#login:
# pattern: /login
# defaults: { _controller: WallabagCoreBundle:Security:login }
#
#login_check:
# pattern: /login_check
#
#logout:
# path: /logout
rest :
type : rest
resource : "routing_rest.yml"

View file

@ -79,7 +79,7 @@ class Config
/*
* @param User $user
*/
public function __construct(Wallabag\UserBundle\Entity\User $user)
public function __construct(\Wallabag\UserBundle\Entity\User $user)
{
$this->user = $user;
}

View file

@ -143,7 +143,7 @@ class Entry
/*
* @param User $user
*/
public function __construct(Wallabag\UserBundle\Entity\User $user)
public function __construct(\Wallabag\UserBundle\Entity\User $user)
{
$this->user = $user;
$this->tags = new ArrayCollection();

View file

@ -46,7 +46,7 @@ class Tag
*/
private $user;
public function __construct(User $user)
public function __construct(\Wallabag\UserBundle\Entity\User $user)
{
$this->user = $user;
$this->entries = new ArrayCollection();

View file

@ -9,8 +9,8 @@ use Symfony\Component\HttpFoundation\Response;
use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener;
use Wallabag\CoreBundle\Entity\User;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\UserBundle\Entity\User;
class RegistrationConfirmedListenerTest extends KernelTestCase
{

View file

@ -21,7 +21,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
public function logInAs($username)
{
$crawler = $this->client->request('GET', '/login');
$form = $crawler->filter('input[type=submit]')->form();
$form = $crawler->filter('button[type=submit]')->form();
$data = array(
'_username' => $username,
'_password' => 'mypassword',

View file

@ -1 +0,0 @@
Hello {{ name }}!

View file

@ -0,0 +1,32 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}create an account{% endtrans %}{% endblock %}
{% block body_class %}register{% endblock %}
{% block menu %}{% endblock %}
{% block messages %}{% endblock %}
{% block content %}
<main class="valign-wrapper">
<div class="valign row">
<div class="card sw">
<div class="center"><img src="{{ asset('themes/baggy/img/logo-other_themes.png') }}" alt="wallabag logo" /></div>
{% include "FOSUserBundle:Registration:register_content.html.twig" %}
</div>
<div class="center">
<a href="{{ path('fos_user_security_login') }}">{% trans %}Already have an account?{% endtrans %}</a>
</div>
</div>
</main>
<style>
main {
padding: 0;
}
</style>
{% endblock %}
{% block footer %}
{% endblock %}

View file

@ -0,0 +1,14 @@
{% trans_default_domain 'FOSUserBundle' %}
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
<div class="card-content">
{{ form_widget(form) }}
<input type="submit" value="{{ 'registration.submit'|trans }}" />
</div>
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="send">
{% trans %}Create account{% endtrans %}
<i class="mdi-content-send right"></i>
</button>
</div>
</form>

View file

@ -0,0 +1,27 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %}
{% block body_class %}login{% endblock %}
{% block menu %}{% endblock %}
{% block content %}
<main class="valign-wrapper">
<div class="valign row">
<h1>{% trans %}Forgot password{% endtrans %}</h1>
<div class="card sw">
<div class="card-content">
<span class="card-title black-text">
<p>{{ 'An email has been sent to %email%. It contains a link you must click to reset your password.'|trans({'%email%': email}) }}</p>
</span>
</div>
</div>
</div>
</main>
<style>
main {
padding: 0;
}
</style>
{% endblock %}

View file

@ -0,0 +1,59 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %}
{% block body_class %}login{% endblock %}
{% block menu %}{% endblock %}
{% block content %}
<main class="valign-wrapper">
<div class="valign row">
<h1>{% trans %}Forgot password{% endtrans %}</h1>
<div class="card sw">
<form action="{{ path('forgot_password') }}" method="post" name="forgotPasswordform">
<div class="card-content">
<span class="card-title black-text"><p>{% trans %}Enter your email address below and we'll send you password reset instructions.{% endtrans %}</p></span>
{% if form_errors(form) %}
<span class="black-text">{{ form_errors(form) }}</span>
{% endif %}
{% for flashMessage in app.session.flashbag.get('notice') %}
<span class="black-text"><p>{{ flashMessage }}</p></span>
{% endfor %}
{% if form_errors(form.email) %}
<span class="black-text">{{ form_errors(form.email) }}</span>
{% endif %}
<div class="input-field s12">
{{ form_label(form.email) }}
{{ form_widget(form.email) }}
</div>
</div>
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="send">
{% trans %}Send{% endtrans %}
<i class="mdi-content-send right"></i>
</button>
</div>
{{ form_rest(form) }}
</form>
</div>
<div class="center">
<a href="{{ path('login') }}">{% trans %}Back to login{% endtrans %}</a>
</div>
</div>
</main>
<style>
main {
padding: 0;
}
</style>
{% endblock %}
{% block footer %}
{% endblock %}

View file

@ -0,0 +1,69 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}login to your wallabag{% endtrans %}{% endblock %}
{% block body_class %}login{% endblock %}
{% block menu %}{% endblock %}
{% block messages %}{% endblock %}
{% block content %}
<main class="valign-wrapper">
<div class="valign row">
<div class="card sw">
<div class="center"><img src="{{ asset('themes/baggy/img/logo-other_themes.png') }}" alt="wallabag logo" /></div>
<form action="{{ path('fos_user_security_check') }}" method="post" name="loginform">
<div class="card-content">
{% if error %}
<span class="black-text">{{ error.message }}</span>
{% endif %}
{% for flashMessage in app.session.flashbag.get('notice') %}
<span class="black-text"><p>{{ flashMessage }}</p></span>
{% endfor %}
<div class="row">
<div class="input-field col s12">
<label for="username">{% trans %}Username{% endtrans %}</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" />
</div>
<div class="input-field col s12">
<label for="password">{% trans %}Password{% endtrans %}</label>
<input type="password" id="password" name="_password" />
</div>
<div class="input-field col s12">
<input type="checkbox" id="remember_me" name="_remember_me" checked />
<label for="remember_me">{% trans %}Keep me logged in{% endtrans %}</label>
</div>
</div>
</div>
<div class="card-action">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
<button class="btn waves-effect waves-light" type="submit" name="send">
{% trans %}Login{% endtrans %}
<i class="mdi-content-send right"></i>
</button>
<a href="{{ path('fos_user_registration_register') }}">{% trans %}Register{% endtrans %}</a>
</div>
</form>
</div>
<div class="center">
<a href="{{ path('fos_user_resetting_request') }}">{% trans %}Forgot your password?{% endtrans %}</a>
</div>
</div>
</main>
<style>
main {
padding: 0;
}
</style>
{% endblock %}
{% block footer %}
{% endblock %}

View file

@ -0,0 +1,57 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}Change password{% endtrans %}{% endblock %}
{% block body_class %}login{% endblock %}
{% block menu %}{% endblock %}
{% block content %}
<main class="valign-wrapper">
<div class="valign row">
<div class="card sw">
<form action="{{ path('forgot_password_reset', {'token': token}) }}" method="post" name="loginform">
<div class="card-content">
<span class="card-title black-text"><p>{% trans %}Change password{% endtrans %}</p></span>
{% if form_errors(form) %}
<span class="black-text">{{ form_errors(form) }}</span>
{% endif %}
{% if form_errors(form.new_password.first) %}
<span class="black-text">{{ form_errors(form.new_password.first) }}</span>
{% endif %}
{% if form_errors(form.new_password.second) %}
<span class="black-text">{{ form_errors(form.new_password.second) }}</span>
{% endif %}
<div class="input-field s12">
{{ form_label(form.new_password.first) }}
{{ form_widget(form.new_password.first) }}
</div>
<div class="input-field s12">
{{ form_label(form.new_password.second) }}
{{ form_widget(form.new_password.second) }}
</div>
</div>
<div class="card-action">
<button class="btn waves-effect waves-light" type="submit" name="send">
{% trans %}Change password{% endtrans %}
<i class="mdi-content-send right"></i>
</button>
</div>
{{ form_rest(form) }}
</form>
</div>
</div>
</main>
<style>
main {
padding: 0;
}
</style>
{% endblock %}

View file

@ -6,4 +6,8 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
class WallabagUserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}