Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
235c56fc
Commit
235c56fc
authored
Jun 15, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fake session data for login
parent
50babdb0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
4 deletions
+17
-4
app.js
app/app.js
+10
-1
index.html
app/index.html
+1
-0
login.js
app/login/login.js
+1
-1
login_service.js
app/login/login_service.js
+5
-2
No files found.
app/app.js
View file @
235c56fc
...
@@ -12,6 +12,7 @@ angular.module(
...
@@ -12,6 +12,7 @@ angular.module(
'oc.lazyLoad'
,
'oc.lazyLoad'
,
'ngRoute'
,
'ngRoute'
,
'ngSanitize'
,
'ngSanitize'
,
'ngCookies'
,
//'ngAnimate',
//'ngAnimate',
//'ngQuantum',
//'ngQuantum',
//'general',
//'general',
...
@@ -58,7 +59,15 @@ angular.module(
...
@@ -58,7 +59,15 @@ angular.module(
})
})
.
otherwise
({
redirectTo
:
'/dashboard'
});
.
otherwise
({
redirectTo
:
'/dashboard'
});
}]).
}]).
run
(
function
(
$rootScope
,
$location
)
{
run
(
function
(
$rootScope
,
$location
,
$cookies
)
{
/**
* todo: below session id is temporary session_id
* the login logic will be finished when backend complete
*
*/
var
sessionId
=
$cookies
.
get
(
'session'
);
$rootScope
.
loggedInUser
=
sessionId
?
true
:
false
;
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
)
{
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
)
{
if
(
$rootScope
.
loggedInUser
==
null
)
{
if
(
$rootScope
.
loggedInUser
==
null
)
{
// no logged user, redirect to /login
// no logged user, redirect to /login
...
...
app/index.html
View file @
235c56fc
...
@@ -87,6 +87,7 @@
...
@@ -87,6 +87,7 @@
<script
src=
"bower_components/oclazyload/dist/ocLazyLoad.min.js"
></script>
<script
src=
"bower_components/oclazyload/dist/ocLazyLoad.min.js"
></script>
<script
src=
"bower_components/angular-route/angular-route.min.js"
></script>
<script
src=
"bower_components/angular-route/angular-route.min.js"
></script>
<script
src=
"bower_components/angular-cookies/angular-cookies.min.js"
></script>
<script
src=
"bower_components/angular-resource/angular-resource.min.js"
></script>
<script
src=
"bower_components/angular-resource/angular-resource.min.js"
></script>
<!--<script src="bower_components/angular-schema-form/dist/schema-form.js"></script>-->
<!--<script src="bower_components/angular-schema-form/dist/schema-form.js"></script>-->
...
...
app/login/login.js
View file @
235c56fc
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
// TODO: password hash or not??
// TODO: password hash or not??
// TODO: who field can be removed??
// TODO: who field can be removed??
var
login
=
angular
.
module
(
'zaerp.login'
,
[
'ngRoute'
,
'schemaForm'
]);
var
login
=
angular
.
module
(
'zaerp.login'
,
[
'ngRoute'
,
'schemaForm'
,
'ngCookies'
]);
login
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$q
,
$timeout
,
LoginService
)
{
login
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$q
,
$timeout
,
LoginService
)
{
$scope
.
schema
=
$scope
.
schema
=
{
{
...
...
app/login/login_service.js
View file @
235c56fc
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
// TODO: login url change with correct one
// TODO: login url change with correct one
login
.
factory
(
'LoginService'
,
function
(
$http
,
$rootScope
,
$location
,
$log
,
Session
,
RESTURL
)
{
login
.
factory
(
'LoginService'
,
function
(
$http
,
$rootScope
,
$location
,
$log
,
$cookies
,
Session
,
RESTURL
)
{
var
loginService
=
{};
var
loginService
=
{};
loginService
.
login
=
function
(
credentials
)
{
loginService
.
login
=
function
(
credentials
)
{
...
@@ -26,8 +26,11 @@ login.factory('LoginService', function ($http, $rootScope, $location, $log, Sess
...
@@ -26,8 +26,11 @@ login.factory('LoginService', function ($http, $rootScope, $location, $log, Sess
if
(
res
.
data
.
success
){
if
(
res
.
data
.
success
){
$rootScope
.
loggedInUser
=
true
;
$rootScope
.
loggedInUser
=
true
;
$location
.
path
(
"/dashboard"
);
$location
.
path
(
"/dashboard"
);
Session
.
create
(
res
.
data
.
id
,
res
.
data
.
user
.
id
,
var
session
=
Session
.
create
(
res
.
data
.
id
,
res
.
data
.
user
.
id
,
res
.
data
.
user
.
role
);
res
.
data
.
user
.
role
);
$log
.
info
(
session
);
$cookies
.
put
(
'sessionId'
,
123456
);
console
.
log
(
$cookies
.
getAll
());
return
res
.
data
.
user
;
return
res
.
data
.
user
;
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment