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 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害