Silex2:安全防火墙和语言环境

时间:2017-09-11 12:23:19

标签: symfony silex

如何将当前区域设置添加到/ user / login或/ user / logout等路径?控制器支持' {_ locale}'占位符,但在安全模式中,它被报告为错误。

$app['security.firewalls'] = array(
    'login' => array(
        'pattern' => '^/user/login$',
    ),
    'secured_area' => array(
        'pattern' => '^.*$',
        'anonymous' => false,
        'remember_me' => array(),
        'form' => array(
           'login_path' => '/user/login',
           'check_path' => '/user/login_check',
        ),
       'logout' => array(
           'logout_path' => '/user/logout',
           'invalidate_session' => true,
       ),
    ),
 );

1 个答案:

答案 0 :(得分:1)

解决方案是在' login_path'中使用路由名称(控制器绑定),而不是完整路径。

import React, { Component } from 'react';

class Asgn6 extends Component {
  constructor(){
    super();
    this.state={
      content:[
        {srcImg:"../img/1.png", text:"Black"},
        {srcImg:"../img/2.png", text:"Blue"},
        {srcImg:"../img/3.png", text:"Green"}
      ]
    }
  }
  add=() => {

  }
  render() {
    return (
        <div>
        {this.state.content.map((obj, index)=> {
          return (
          <div key={index}>
          <img src={require(obj.srcImg)} alt={obj.text}/>
          <p>{obj.text}</p>
          </div>
          );
        })}
          );
        <button onClick={this.add}>Add</button>
        </div>



    );
  }

}

export default Asgn6;