如何在 YII 网络应用程序前面创建安卓类型的锁屏


How to create a Android type lock screen in front of a YII web app

提前感谢您的任何建议。

我是长期开发人员,但对网络内容很陌生,所以请原谅任何无知。

我正在尝试创建一个 android 类型的锁定屏幕(您将鼠标按正确的顺序移动到块上以创建密码)。在此之后,它将显示我的yii应用程序的登录页面。

这将用于我们在客户端位置安装的盒子来管理我们的东西。因此,客户端只能访问http Web访问权限 - 不太担心密码嗅探等。

我有一个

锁定屏幕的模型,我有一个基本的 yii 应用程序,如果未经过身份验证,则默认为登录屏幕。我假设我需要合并我的模型和登录页面。如果用户即使在登录屏幕上也经过身份验证,也不会显示我的锁定屏幕。

问题:

  1. 如何将锁屏密码安全地传递到后端身份验证(我在考虑按钮单击时的 POST 方法)
  2. 身份验证后如何隐藏锁定屏幕(在 yii/php 中决定以查看使用是否经过身份验证)
  3. 任何更好的想法都被优雅地接受:-)3.

编辑 如果用户获得错误的密码,还希望重置,您如何看待另一个按钮/左键单击网格?

假设使用 yiic 创建的示例登录页面。

我的示例锁定屏幕

<!DOCTYPE html>
<html>
<head>
   <title></title>
   <style type="text/css">
.untouched {
   background: green;
}
.touched {
   background: blue;
}
.button {
   padding: 12px;
   height: 100px;
   width: 100px;
}
   </style>
   <script src="/jquery.js"></script>
</head>
<body>
   <table>
      <tr>
         <td id="1" class="button untouched"></td>
         <td id="2" class="button untouched"></td>
         <td id="3" class="button untouched"></td>
         <td id="4" class="button untouched"></td>
      </tr>
      <tr>
         <td id="5" class="button untouched"></td>
         <td id="6" class="button untouched"></td>
         <td id="7" class="button untouched"></td>
         <td id="8" class="button untouched"></td>
      </tr>
      <tr>
         <td id="9" class="button untouched"></td>
         <td id="10" class="button untouched"></td>
         <td id="11" class="button untouched"></td>
         <td id="12" class="button untouched"></td>
      </tr>
      <tr>
         <td id="13" class="button untouched"></td>
         <td id="14" class="button untouched"></td>
         <td id="15" class="button untouched"></td>
         <td id="16" class="button untouched"></td>
      </tr>
   </table>
   <h1 id="password"></h1>
   <script>
      $(document).ready(function(){
      });
      $(".untouched").mouseenter(function(){
         if($(this).hasClass("untouched"))
         {
            $("#password").text($("#password").text() + ' ' + $(this).attr("id"));
         }
         $(this).removeClass("untouched").addClass("touched");
      });
   </script>
</body>
</html>
  1. POST方法是对用户进行身份验证的正确方法,永远不要考虑GET因为用户名和密码对任何人都可见。
  2. 您可以使用javascript将会话ID或类似内容保存在localStorage(首选)或cookie中,以了解用户是否通过AJAX进行身份验证并访问页面API,当API抛出带有标头的错误时401 Unauthorized,让您的应用程序再次提示登录页面。
  3. 如果您的应用需要与服务器交互,您可以查看基于 OAuth 的应用程序的工作原理。

现场小提琴示例