empresa-libre/source/templates/login.html

74 lines
2.0 KiB
HTML

<%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
}
var values = form.getValues()
webix.ajax().post("/", values, function(text, data, xhr) {
var values = data.json();
if (values.login) {
if (values.super) {
window.location = "/admin"
}else{
window.location = "/main"
}
} else {
webix.message({ type:"error", text: values.msg })
}
});
};
function lst_languages_change(nv, ov){
multilang.setLanguage(nv)
var html_font = '<font color="#610B0B">'
var html_font_close = '</font>'
webix.ajax().get("/values/titlelogin", function(text, data, xhr){
var value = data.json();
$$('lst_languages').define('label', multilang.get('languages'))
$$('lst_languages').refresh()
var html = html_font + multilang.get('welcome') + value + html_font_close
$$('title_login').setHTML(html);
html = html_font + multilang.get('access') + html_font_close
$$('header_access').setHTML(html)
$$('txt_usuario').define('label', multilang.get('user'))
$$('txt_usuario').refresh()
$$('txt_contra').define('label', multilang.get('password'))
$$('txt_contra').refresh()
$$('cmd_login').setValue(multilang.get('login'))
})
}
webix.ready(function(){
webix.ui(ui_login);
$$('lst_languages').attachEvent('onChange', lst_languages_change)
$$('lst_languages').setValue(multilang.get_default())
$$("txt_rfc").focus();
});
</script>
</%block>