Jquery mobile logging in and accessing/rejecting page

Asked
Active3 hr before
Viewed126 times

8 Answers

jqueryloggingmobile
90%

I know this site isn't asking for people to work on a specific code, but I'm having a real hard time looking for examples/tutorial on jquery mobile login. I'm not sure if I'm doing this right, but I'm trying to get a user to login based on mysql database (if user is in my database), but I'm trying to figure out what to write up when user logs in? How do i set up so it will redirect to home page?
PHP page
if(isset($_POST['email']) && isset($_POST['pass'])){
$email = mysql_real_escape_string($_POST['email']);
$password = md5(mysql_real_escape_string($_POST['email']));
$sql = mysql_query("SELECT password,email FROM users WHERE email = ".$email." AND password = ".$password." LIMIT 1");
}
index.html
$('form#login').submit(function(){
var email = $("form#login input.email").val();
var pass = $("form#login input.pass").val();
$.post("ajax/post_login.php", {email: email, pass: pass},
function(data){
alert("failed"); //if not logged in
});
});
I'm having trouble here?
Can someone help me out with jquery mobile?
I have different many <div data-role="page">(content here)</div> and I want to know how to access a certain page, when logged in? and if email/username fails, theres an error?
I appreciate your help! Thank you!
load more v
88%

My Jquery mobile application has a simple login page through which the user will login and will be able to access the rest of the pages.But the problem here is that i am still able to access the rest of pages without logging in.The login session is maintained at client side using cookie as there is no session maintained at the server side.I have a single HTML file in which i have all the required jquery mobile pages.Is there any way that i can restrict the direct access to the internal pages of my application.,Possibly you wouldn't even need to override an event, maybe one of the existing ones will do what you want. You can use firebug to inspect the event handler variables to see if there is a parameter option to prevent navigating to the next page. , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,I found another simple solution.Earlier when I had this question I used to check the cookie session during the onClick event of the button click.But now I have changed it by checking the cookie session during pageshow event described below.

I found another simple solution.Earlier when I had this question I used to check the cookie session during the onClick event of the button click.But now I have changed it by checking the cookie session during pageshow event described below.

$('mypage').live('pageshow', function(event, ui) {
   if (checkCookie()) {
      //do some task    
   } else {
      alert('Your Session has Expired or User not Logged In');
      $.mobile.changePage("#login", "slide", true, true);
   }
});
load more v
72%

pagechange Fired off after all page loading and transitions. NOTE: this event was formally known as “changepage”. ,single retina-regular or separate sprites,NOTE: this event was formally known as “changepage”.,Fired off before any page loading or transition.

Copy-and-Paste Snippet for CDN-hosted files (recommended):

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.js"></script>
load more v
65%

here’s the log in screen’s mockup that we built in the third part of this tutorial : , in the “main” div we are using a couple of links to the sign in and sign up screens respectively. the links point to the sign-in.html and sing-up.html files that we will create in a few minutes. , in this part of the tutorial we will only create the static html for the screens. in future articles we will implement the programming logic that makes the pages work. , the first step we are going to take is to set up a jquery mobile project for the app.

let’s create an empty index.html file in the “conf-rooms” directory, and add a jquery mobile page template to the file as follows:

<!doctype html>
<html>

<head>
   <title>conference room booking app - welcome</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link href="css/themes/1/conf-room1.min.css" rel="stylesheet" />
   <link href="css/themes/1/jquery.mobile.icons.min.css" rel="stylesheet" />
   <link href="../../lib/jqm/1.4.4/jquery.mobile.structure-1.4.4.min.css" rel="stylesheet" />
   <link href="css/app.css" rel="stylesheet" />
   <script src="../../lib/jquery/2.1.1/jquery-2.1.1.min.js"></script>
   <script src="../../lib/jqm/1.4.4/jquery.mobile-1.4.4.min.js"></script>
</head>

<body>
   <div data-role="page">
      <div data-role="header" data-theme="c">
         <h1>book it</h1>
      </div><!-- /header -->
      <div role="main" class="ui-content">
         <h2 class="mc-text-center">welcome!</h2>
         <p class="mc-top-margin-1-5"><b>existing users</b></p>
         <a href="sign-in.html" class="ui-btn ui-btn-b ui-corner-all">sign in</a>
         <p class="mc-top-margin-1-5"><b>don't have an account?</b></p>
         <a href="sign-up.html" class="ui-btn ui-btn-b ui-corner-all">sign up</a>
         <p></p>
      </div><!-- /content -->
   </div><!-- /page -->
</body>

</html>
load more v
75%

If no arguments are passed to jQuery.when(), it will return a resolved Promise.,Description: Provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events., deferreds Type: Deferred or Promise or Thenable Zero or more Thenable objects. ,Execute the function myFunc when both ajax requests are successful, or myFailure if either one has an error.

$.when($.ajax("test.aspx")).then(function(data, textStatus, jqXHR) {
         alert(jqXHR.status); // Alerts 200});
load more v
40%

For mobile apps, use the Facebook SDKs for iOS and Android, and follow the separate guides for these platforms.,Storing access tokens and login status,Facebook Login lets people decline sharing some permissions with your app. The Login Dialog contains a screen that looks like this:,When using a desktop app and logging in, Facebook redirects people to the redirect_uri mentioned above and places an access token along with some other metadata (such as token expiry time) in the URI fragment:

Your app must initiate a redirect to an endpoint which will display the login dialog:

https: //www.facebook.com/v12.0/dialog/oauth?
   client_id = {
      app - id
   } &
   redirect_uri = {
      redirect - uri
   } &
   state = {
      state - param
   }

For example, if your login request looks like:

https: //www.facebook.com/v12.0/dialog/oauth?
   client_id = {
      app - id
   } &
   redirect_uri = {
      "https://www.domain.com/login"
   } &
   state = {
      "{st=state123abc,ds=123456789}"
   }

then your redirect URI would be called with this:

https: //www.domain.com/login?state="{st=state123abc,ds=123456789}"

If you are building Login for a Windows app you can use the Package Security Identifier as your redirect_uri. Trigger the Login Dialog by calling WebAuthenticationBroker.AuthenticateAsync and use the Login Dialog endpoint as the requestUri. Here is an example in JavaScript:

var requestUri = new Windows.Foundation.Uri(
      "https://www.facebook.com/v12.0/dialog/oauth?
      client_id = {
         app - id
      } &
      display = popup &
      response_type = token &
      redirect_uri = ms - app: //{package-security-identifier}");

      Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAsync(
         options,
         requestUri)
      .done(function(result) {
         // Handle the response from the Login Dialog
      });

When using a desktop app and logging in, Facebook redirects people to the redirect_uri mentioned above and places an access token along with some other metadata (such as token expiry time) in the URI fragment:

https: //www.facebook.com/connect/login_success.html#
   access_token = ACCESS_TOKEN...

If people using your app don't accept the Login dialog and clicks Cancel, they'll be redirected to the following:

YOUR_REDIRECT_URI ?
   error_reason = user_denied &
   error = access_denied &
   error_description = Permissions + error.
load more v
22%

This is where becoming a well-versed Apache Cordova developer can come in handy by providing a way to develop mobile applications using standard web technologies—HTML5, CSS3, and JavaScript.,Mobile applications are creeping in. Developing for each mobile platform can be an exhaustive task, especially if resources are limited. This is where Apache Cordova comes in handy by providing a way to develop mobile applications using standard web technologies - HTML5, CSS3 and JavaScript. This article explores how one can get started with Apache Cordova and build mobile applications targeted at a wide range of mobile devices.,Apache Cordova is a framework for creating cross-platform mobile apps using standard web technologies. Essentially, it's an application container with a web view that covers the entire screen of the device.,Apache Cordova comes with a set of pre-developed plugins which provide access to the device’s camera, GPS, file system, etc. As mobile devices evolve, adding support for additional hardware is simply a matter of developing new plugins.

Cordova CLI depends on Node.js and the Git client, so go ahead and download and install Node from nodejs.org, and Git from git-scm.com. You will be using npm to install Cordova CLI itself as well as for installing additional plugins, and Cordova will use git behind the scenes in order to download required dependencies. Finally, run

npm install - g cordova
load more v
60%

This example logs information about the unhandled promise rejection to the console.,Here we have a few examples showing ways you can make use of the unhandledrejection event. The event includes two useful pieces of information:,The reason that would have been passed into the rejection handler if one had existed. See catch() for details.,You can also use the onunhandledrejection event handler property to set up the event listener:

window.addEventListener("unhandledrejection", event => {
   console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`);
});
load more v

Other "jquery-logging" queries related to "Jquery mobile logging in and accessing/rejecting page"