duanlu7680 2013-08-22 11:31
浏览 50
已采纳

如何使用jQuery Mobile构建一个可靠的安全区域?

I was trying to build a secured area where the user has to log in through a login form. Nothing special here and I used what I always did : - a login - a success page I am using AJAX in order to validate the form

I though it would be more secured to have this into two distinct php pages so a user cannot hack in any way the DOM and go to the pageid of the success page -- since all the pages are supposed to be in the same file.

But I red this post : https://stackoverflow.com/a/15806954/1083453

and I don't know if it is finally possible to do what I am trying to do.

So my question is: How do I build a solid and secured login system with jQuery Mobile to work on any platform (W7/iOS/Android/Blackberry 10)

Thank you

EDIT:

For now I'm doing:

function verifyLogin(){        
        var email=document.getElementById("loginUserField").value;
        var pwd=document.getElementById("loginPwdField").value;  

          $.ajax({
                type : 'POST',           
                url : server_url + 'application/login', // Servlet URL           
                data:{
                    'email':email,
                    'pwd':pwd
                },
                success : function(data) {        
                    if(data.logged_in){                     
                        alert("Login Success!!");
                        window.navigate("home.php");

                    } else {
                        alert("Invalid Login!!");
                            console.log( data );
                        if( data.errors ) {
                            //define
                            var error = {};
                            error.alert = data.errors;

                            //Append
                            var template = Handlebars.compile( $('#alertTemplate').html() );
                            $('#errors').empty().append( template(error) );

                            //Erase
                            error = {};
                        }
                    }
                },
                error : function(xhr, type) { 
                    alert('server error occurred');
                } 
          });    
    }

(the windows navigate doesn't work ..) but anyway, is it the right way to do it? this is a separated login.php form that let you access the ocntent of the app (let's say home.php)

  • 写回答

1条回答 默认 最新

  • dongqiangse6623 2013-08-22 11:56
    关注

    Well you could build your app upon a PHP framework. I did a similar project for my B.ch degree and I simply added jquery mobile as an UI template. In this way you already have the framworks login system and you use jQuery Mobile as a front end template.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容