首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Drupal 8:如何停止drupal库存会话?

Drupal 8:如何停止drupal库存会话?
EN

Stack Overflow用户
提问于 2017-01-05 07:59:50
回答 1查看 1.9K关注 0票数 3

我创建了一个模块来验证用户的身份,这要归功于一张卡片,我需要检查他们是否可以访问这个网站。

问题在于Drupal管理会话的方式。它存储数据库中的每个会话并恢复它,因此用户会自动登录,这将导致用户不通过检查过程。

是否有可能停止存储数据库中的会话?

EN

回答 1

Stack Overflow用户

发布于 2017-01-06 00:01:51

在Drupal 8中,可以在/sites/default/services.yml中设置cookie/会话生存期

将cookie_lifetime设置为0意味着用户的会话只会持续到浏览器选项卡关闭为止,所以当他们重新访问站点时,他们需要再次登录。

例如services.yml

代码语言:javascript
复制
parameters:
  session.storage.options:
    # Default ini options for sessions.
    #
    # Some distributions of Linux (most notably Debian) ship their PHP
    # installations with garbage collection (gc) disabled. Since Drupal depends
    # on PHP's garbage collection for clearing sessions, ensure that garbage
    # collection occurs by using the most common settings.
    # @default 1
    gc_probability: 1
    # @default 100
    gc_divisor: 100
    #
    # Set session lifetime (in seconds), i.e. the time from the user's last
    # visit to the active session may be deleted by the session garbage
    # collector. When a session is deleted, authenticated users are logged out,
    # and the contents of the user's $_SESSION variable is discarded.
    # @default 200000
    gc_maxlifetime: 200000
    #
    # Set session cookie lifetime (in seconds), i.e. the time from the session
    # is created to the cookie expires, i.e. when the browser is expected to
    # discard the cookie. The value 0 means "until the browser is closed".
    # @default 2000000
    cookie_lifetime: 0
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41479922

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档