- -- ANGULAR --
- function mainController($scope, $rootScope, auth, localStorageService) {
- // USER AUTH CHECK
- isLoggedIn();
- }
- -- JQUERY --
- var DEBUG = false;
- function loadSessionId() {
- //$.mobile.loading('show'); // showing the loader by handling the ajaxStart event doesn't work, so we trigger it manually
- $.ajax({
- url: SERVICE_URL + "/account/getsessionid",
- type: "GET",
- async: false,
- cache: false,
- success: function (response) {
- $.cookie("ASP.NET_SessionId", response.sessionid);
- $.cookie("Culture", localStorage.language);
- if (DEBUG) {
- console.log("SessionId: " + response.sessionid);
- }
- },
- error: function (xhr, status, error) {
- console.log("Error on getting session id. Exception: " + error);
- }
- });
- }
- $(function () {
- loadSessionId();
- });
- function isLoggedIn(forwardPage, fallbackPage) {
- getRequestCode();
- var retVal = null;
- var islI = "0";
- //$.mobile.loading('show'); // showing the loader by handling the ajaxStart event doesn't work, so we trigger it manually
- if (DEBUG) {
- console.log("Start check login with url: " + SERVICE_URL + "/account/logon?rvc=" + localStorage.AppRequestCode + "&crvc=" + localStorage.UserRequestCode);
- }
- $.ajax({
- async: false,
- url: SERVICE_URL + "/account/checklogin?rvc=" + localStorage.AppRequestCode + "&crvc=" + localStorage.UserRequestCode,
- type: "GET",
- cache: false,
- success: function (response) {
- if (response.success) {
- $("#homebacklink").hide();
- updateSaldo();
- $(".userdataSaldoImg").attr("href", "#myaccount");
- if (DEBUG) {
- console.log("UserCode after logon: " + localStorage.UserCode);
- }
- var response = {
- true: 1,
- };
- localStorage.setItem('trueFalse', JSON.stringify(response));
- $('#login-form .error').hide();
- $('.ui-user-id').text(localStorage.Username);
- if (forwardPage != null)
- $.mobile.changePage("#" + forwardPage);
- retVal = 1;
- islI = "1";
- }
- else {
- $("#homebacklink").show();
- $(".userdataSaldoImg").attr("href", "#main");
- if (fallbackPage != null)
- $.mobile.changePage("#" + fallbackPage);
- retVal = 0;
- var response = {
- true: 0,
- };
- localStorage.setItem('trueFalse', JSON.stringify(response));
- }
- },
- error: function (xhr, status, error) {
- console.log("Error on logon. Exception: " + error);
- }
- });
- localStorage.islI = islI;
- return retVal;
- }
SHARE
TWEET
Untitled
a guest
Dec 30th, 2014
161
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

