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
c0132eb9
Commit
c0132eb9
authored
May 12, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handling login submit (fake url)
parent
9dcb244f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
login.html
app/login/login.html
+1
-1
login.js
app/login/login.js
+22
-6
No files found.
app/login/login.html
View file @
c0132eb9
<div
ng-app=
"zaerp.login"
>
<div
ng-app=
"zaerp.login"
>
<div
class=
"starter-template"
ng-controller=
"LoginCtrl"
>
<div
class=
"starter-template"
ng-controller=
"LoginCtrl"
>
<h1>
Zaerp Login Form
</h1>
<h1>
Zaerp Login Form
</h1>
<form
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model
"
></form>
<form
name=
"loginForm"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(loginForm)
"
></form>
</div>
</div>
<hr/>
<hr/>
...
...
app/login/login.js
View file @
c0132eb9
'use strict'
;
'use strict'
;
// TODO: password field fix
angular
.
module
(
'zaerp.login'
,
[
'ngRoute'
,
'schemaForm'
])
angular
.
module
(
'zaerp.login'
,
[
'ngRoute'
,
'schemaForm'
])
.
config
([
'$routeProvider'
,
function
(
$routeProvider
)
{
.
config
([
'$routeProvider'
,
function
(
$routeProvider
)
{
...
@@ -8,7 +11,7 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
...
@@ -8,7 +11,7 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
controller
:
'LoginCtrl'
controller
:
'LoginCtrl'
});
});
}])
}])
.
controller
(
'LoginCtrl'
,
function
(
$scope
)
{
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$http
)
{
$scope
.
schema
=
$scope
.
schema
=
{
{
title
:
"Login"
,
title
:
"Login"
,
...
@@ -16,13 +19,11 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
...
@@ -16,13 +19,11 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
properties
:
{
properties
:
{
email
:
{
email
:
{
type
:
"string"
,
type
:
"string"
,
title
:
"Email"
,
title
:
"Email"
pattern
:
"^[A-Z]"
},
},
pass
:
{
pass
:
{
type
:
"string"
,
type
:
"string"
,
title
:
"Password"
,
title
:
"Password"
pattern
:
"^[A-Z]"
},
},
remember
:
{
remember
:
{
type
:
"boolean"
,
type
:
"boolean"
,
...
@@ -36,7 +37,7 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
...
@@ -36,7 +37,7 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
},
},
required
:
[
"email"
,
"pass"
,
"who"
]
required
:
[
"email"
,
"pass"
,
"who"
]
};
};
$scope
.
fields
=
[
"email"
,
"pass"
,
"who"
,
"remember"
];
//
$scope.fields = ["email", "pass", "who", "remember"];
$scope
.
model
=
{
$scope
.
model
=
{
email
:
"user@example.com"
,
email
:
"user@example.com"
,
remember
:
false
remember
:
false
...
@@ -48,4 +49,19 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
...
@@ -48,4 +49,19 @@ angular.module('zaerp.login', ['ngRoute', 'schemaForm'])
title
:
"Save"
title
:
"Save"
}
}
];
];
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
){
$http
.
post
(
'http://127.0.0.1:8000/login'
,
form
).
success
(
function
(
data
,
status
,
headers
,
config
){
console
.
log
(
data
);
}).
error
(
function
(
data
,
status
,
headers
,
config
){
console
.
log
(
"form submit failed: "
+
status
);
});
}
else
{
console
.
log
(
"not valid"
);
}
}
});
});
\ No newline at end of file
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