ここに最初の質問があります。 私はログインページを開発しています。なぜ私のログインフォームが2回表示されるのか分かりません。私は小枝のファイルと経路を二重にチェックしましたが、何が原因か分かりません。symfony app、コンテンツが2回表示されています
私はdev envにいるので、私はデバッグバーが実際のページに置き換えられてコンテンツが2回表示されていると考えています。デバッガバーが表示されません。私はGoogleで検索し、彼らは閉じていないボディータグについて何か言及していることを見たので、私はそれもチェックした。まだ注目している。他のファイルもログインテンプレートを呼び出しているかどうか確認しました。何もない...どんな提案?
ここには、1000語以上の価値がある画像があります。
コントローラ
/**
* @Route("/login", name="security_login")
*/
public function loginAction(Request $request)
{
$authenticationUtils = $this->get('security.authentication_utils');
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/login.html.twig', array(
'last_username' => $lastUsername,
'error' => $error,
));
}
Securit.yml
:おかげ
またimage shows the login page showing twice
は、ここでsymfonyのドキュメントからまっすぐである私が使用しているコードであり、
providers:
app_user_prov:
entity:
class: AppBundle:User
firewalls:
main:
pattern: ^/
anonymous: ~
guard:
authenticators:
- cas_authenticator
ログイン小枝ファイル:
{% extends 'base.html.twig' %}
{% block content %}
{% if error %}
<div class="row">
<div class="col-lg-12">
<p class="bg-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</p>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-lg-12 text-center" style="margin-top:35px;">
<img style="border:none;" src="loreipsum.png" width="200">
<br /> <br />
<form action="{{ path("security_login") }}" method="post" style="margin-top:15px;">
<div class="form-group">
<label for="username">Username or email</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" required="required" />
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="_password" required="required" />
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
<div class="form-group">
<input type="submit" id="_submit" name="_submit" value="Submit" />
</div>
</form>
</div>
</div>
{% endblock %}
ベース小枝ファイル:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Administration{% endblock %}</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymo
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
<!-- jQuery and Bootstrap -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
{% block javascripts %}{% endblock %}
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-6">
<h1 class="text-left">
<img style="border:none;" src="loremipsum.jpg" width="200">
</h1>
</div>
<div class="col-lg-6">
<h3 class="text-right"> <br/>Lorem ipsum</h3>
</div>
</div>
{% block content %}{% endblock %}
</div>
</body>
</html>
ご提供くださいsome code – DFayet
コードは実際にはsymfonyのドキュメントにあります。同じ構造、同じコード – CookieMonster
私たちにも見せてくださいbase.html.twig、please。 – DFayet