Coldfusion:脚本中的Application.cfc cflogin

时间:2016-09-15 20:57:18

标签: coldfusion application.cfc cflogin

所以我在一个使用coldfusion的地方工作,并在application.cfm文件的项目中使用cflogin:

<cflogin idletimeout="2800">
   <cfif not IsDefined("cflogin")>
    <cfinclude template="login.cfm">
    <cfabort>

  </cfif>
</cflogin>

我自己更喜欢脚本风格,并且读到你应该使用application.CFC而不是CFM online。我仍然是Coldfusion的新手,因为我来自php背景所以我试图使用cflogin,就像他们在标签语法中所做的一样,但是在脚本中继承了onRequestStart函数中的代码:

      if(!isdefined("cflogin"))
      {

        include "/login.cfm";
        abort;
      }
      else{
        //auth code

      }

现在我想知道如何在脚本样式中使用cflogin,这似乎已在CF11中添加 - https://cfdocs.org/cflogin

我的脚本代码加载了登录表单,但是当我提交这个结果时,cflogin没有被定义,因此当他们点击登录时,它只返回登录表单,如页面刷新。我只是有点困惑,因为如果我使用application.cfm文件并使用基于标签的工作,但它不适用于脚本风格?

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

你可以,而不是

<template>
  <div class="facet">
    <div class="">
      <div class="panel-group" id="accordion">
        <div class="panel panel-default">
          <div class="panel-heading">
            <a data-toggle="collapse"v-bind:href="'#facet-' + this.id"><h4 class="panel-title">Regions</h4></a>
          </div>
          <div v-bind:id="'facet-' + id" class="panel-collapse collapse in">
            <ul class="list-group">
              <li v-for="feature in content.features" class="list-group-item">
                <label>
                  <input type="checkbox" class="rChecker"
                    v-on:click="selectRegion"
                    v-bind:value="feature.properties.name"
                    v-model="selected"
                    />
                  <span>{{feature.properties.name}}</span>
                </label>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    props: ['content'],
    data: function() {
      return {
        id: -1,
        selected: []
      }
    },
    methods: {
      selectRegion: function(event) {
        console.log('click: ' + event.target.checked);

        if (event.target.checked) {
          this.selected.push(event.target.value);
        } else {
          var index = this.selected.indexOf(event.target.value);
          this.selected.splice(index, 1);
        }
        this.$emit('selection', event.target.value, event.target.checked);
      },
      reset: function() {
        this.selected.length = 0;
      }
    },
    created: function() {
      this.id = this._uid
    }
  }
</script>

<style>
</style>

使用

if(not isDefined("cflogin"))
相关问题