empresa-libre/source/templates/login.html

44 lines
950 B
HTML
Raw Normal View History

2017-06-27 15:43:02 -05:00
<%inherit file="base.html"/>
<%block name="media">
<script src="/static/js/ui/login.js" type="text/javascript" ></script>
</%block>
<%block name="content">
<div id="form_login"></div>
<script type="text/javascript" charset="utf-8">
function validate_login(){
var form = this.getFormView();
if (!form.validate()) {
webix.message({ type:"error", text:"Valores inválidos" });
return
}
2017-09-21 23:24:18 -05:00
var values = form.getValues()
2017-06-27 15:43:02 -05:00
webix.ajax().post("/", values, function(text, data, xhr) {
var values = data.json();
if (values.login) {
2017-09-21 23:24:18 -05:00
if (values.super) {
window.location = "/admin"
}else{
window.location = "/main"
}
2017-06-27 15:43:02 -05:00
} else {
2017-09-21 23:24:18 -05:00
webix.message({ type:"error", text: values.msg })
2017-06-27 15:43:02 -05:00
}
});
};
webix.ready(function(){
webix.ui(ui_login);
});
</script>
</%block>