简体   繁体   English

试图弄清楚如何在此示例中执行身份验证

[英]trying to figure out how authentication is performed in this example

I am looking at some example code and can't figure out how authentication is done. 我正在查看一些示例代码,但无法弄清楚如何完成身份验证。

Any ideas how this simple code authenticates users? 任何想法,这个简单的代码如何验证用户身份?

Thanks, 谢谢,

 <script type='text/javascript'>
    //<![CDATA[
      window._auth_token_name = "authenticity_token";
      window._auth_token = "k0d6elNSSvaejR63eiqcZrv3O8fU/6VL2kvoqmpdO6k=";

    //]]>
    </script>

  </head>
  <body>
    <div id="messages">
      <div id="info"></div>
      <div id="error"></div>
    </div>
    <div id="header">


</div>
    <div id="center">
      <table>
  <form action="/admin/login" class="new_user" id="new_user" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="k0d6elNSSvaejR63eiqcZrv3O8fU/6VL2kvoqmpdO6k=" /></div>
    <tr>
      <td>Username</td>
      <td><input id="user_username" name="user[username]" size="30" type="text" /></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><input id="user_password" name="user[password]" size="30" type="password" />
    </tr>
    <tr>
      <td colspan="2">
        <input id="user_submit" name="commit" type="submit" value="Log in" />
      </td>
    </tr>
  </form>
</table>
    </div>

that simple code does not authenticate anything, It's simply a html page with a form to submit. 那个简单的代码不会对任何内容进行身份验证,它只是一个带有提交表单的html页面。 The authentication process takes place on a server at this route: /admin/login 身份验证过程在服务器上通过以下路径进行: /admin/login

the server could be anything.. php, ruby on rails etc 服务器可以是任何东西.. php,ruby上的ruby等

The authentication is done on the server side in the code that responds to the action admin/login. 身份验证在响应操作admin / login的代码中的服务器端完成。 The authenticity you see on the page is to prevent cross site scripting and is in no way connected to the login. 您在页面上看到的真实性是为了防止跨站点脚本编写,并且与登录名绝对无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM