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

auth form -v4

parent 06e1d4c2
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
<div id ="form_player_container" align ="center"> <div id ="form_player_container" align ="center">
<div id ="form_player_div" ></div> <div id ="form_player_div" ></div>
</div> </div>
<div id="authForm"></div> <div id ="authForm"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -7,24 +7,21 @@ var portal = { ...@@ -7,24 +7,21 @@ var portal = {
player : null, player : null,
clearPlayer : function() { clearPlayer : function() {
if(portal.player) { if(portal.player) {
portal.player.destroy(); portal.player.destroy();
} }
}, },
createPlayer : function(formCode){ createPlayer : function(dataId){
portal.clearPlayer(); portal.clearPlayer();
portal.player = AS.FORMS.createPlayer(); 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')); portal.player.view.appendTo($('#form_player_div'));
} }
}; };
AS.SERVICES.unAuthorized = function()
{
CreateAuthForm();
};
function CreateAuthForm(){ function CreateAuthForm(){
var forma = document.createElement("form"); var forma = document.createElement("form");
...@@ -81,18 +78,18 @@ var authFunc = function(){ ...@@ -81,18 +78,18 @@ var authFunc = function(){
jQuery(".submit").on( "click", function(event){ jQuery(".submit").on( "click", function(event){
AS.OPTIONS.login = $("input#login").val(); AS.OPTIONS.login = $("input#login").val();
AS.OPTIONS.password = $("input#password").val(); AS.OPTIONS.password = $("input#password").val();
var xhr = new XMLHttpRequest(); portal.createPlayer();
AS.FORMS.ApiUtils.simpleAsyncGet('rest/api', xhr);
if (xhr.status != 200) {
$(".form_player_container").show(); $(".form_player_container").show();
portal.createPlayer("timesheet");
$(".login-form").remove(); $(".login-form").remove();
} else {
CreateAuthForm();
}
}); });
}; };
AS.SERVICES.unAuthorized = function()
{
$(".authForm").remove();
CreateAuthForm();
};
$(document).ready(function(){ $(document).ready(function(){
CreateAuthForm(); CreateAuthForm();
$(".error").hide(); $(".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