Commit 7e4f12b3 authored by Alina Habibulina's avatar Alina Habibulina

auth form -v4

parent 06e1d4c2
......@@ -18,6 +18,6 @@
<div id ="form_player_container" align ="center">
<div id ="form_player_div" ></div>
</div>
<div id="authForm"></div>
<div id ="authForm"></div>
</body>
</html>
\ No newline at end of file
......@@ -7,24 +7,21 @@ var portal = {
player : null,
clearPlayer : function() {
if(portal.player) {
portal.player.destroy();
}
},
createPlayer : function(formCode){
createPlayer : function(dataId){
portal.clearPlayer();
portal.player = AS.FORMS.createPlayer();
portal.player.showFormByCode(formCode);
portal.player.view.setEditable(_.isUndefined(dataId));
portal.player.showFormData("097a00e2-430c-436d-92e5-c2ea8edc5b30", 1, dataId);
portal.player.view.appendTo($('#form_player_div'));
}
};
AS.SERVICES.unAuthorized = function()
{
CreateAuthForm();
};
function CreateAuthForm(){
var forma = document.createElement("form");
......@@ -81,18 +78,18 @@ var authFunc = function(){
jQuery(".submit").on( "click", function(event){
AS.OPTIONS.login = $("input#login").val();
AS.OPTIONS.password = $("input#password").val();
var xhr = new XMLHttpRequest();
AS.FORMS.ApiUtils.simpleAsyncGet('rest/api', xhr);
if (xhr.status != 200) {
portal.createPlayer();
$(".form_player_container").show();
portal.createPlayer("timesheet");
$(".login-form").remove();
} else {
CreateAuthForm();
}
});
};
AS.SERVICES.unAuthorized = function()
{
$(".authForm").remove();
CreateAuthForm();
};
$(document).ready(function(){
CreateAuthForm();
$(".error").hide();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment