[IMP] Improve login for auth_signup/oauth seperation

bzr revid: fme@openerp.com-20140227154921-2fqr8p8bhczn37xa
This commit is contained in:
Fabien Meghazi 2014-02-27 16:49:21 +01:00
commit 6aa24d0896
4 changed files with 22 additions and 45 deletions

View File

@ -638,6 +638,9 @@ class Home(http.Controller):
def web_login(self, redirect=None, **kw):
ensure_db()
if not request.uid:
request.uid = openerp.SUPERUSER_ID
values = request.params.copy()
if not redirect:
redirect = '/web?' + request.httprequest.query_string

View File

@ -513,7 +513,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
var fields = $(form).serializeArray();
self.rpc("/web/database/create", {'fields': fields}).done(function(result) {
if (result) {
instance.web.redirect('/web')
instance.web.redirect('/web');
} else {
alert("Failed to create database");
}
@ -1488,24 +1488,6 @@ instance.web.embed = function (origin, dbname, login, key, action, options) {
client.insertAfter(currentScript);
};
openerp.web.LoginForm = openerp.web.Widget.extend({
init: function ($form) {
this._super(/* no parent */);
this.setElement($form);
this.$el.on('submit', this.on_submit);
this.start();
},
start: function () {
if (location.hash) {
this.$el.attr('action', this.$el.attr('action') + location.hash);
}
return this._super();
},
on_submit: function () {
return true;
},
});
})();
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:

View File

@ -38,11 +38,14 @@
{% endif %}
</div>
<hr/>
{% if debug %}
<input type="hidden" name="debug" value=""/>
{% endif %}
<input type="submit" value="Continue" class="btn btn-primary pull-right"/>
<noscript>
<hr/>
<input type="submit" value="Continue" class="btn btn-primary pull-right"/>
</noscript>
<div class="oe_single_form_footer">
<a class="oe_login_manage_db" href="/web/database/manager{% if debug %}?debug{% endif %}">Manage Databases</a> |

View File

@ -47,6 +47,10 @@
<template id="web.login_layout" name="Login Layout">
<t t-call="web.layout">
<t t-set="head">
<link href="/web/static/src/css/base.css" rel="stylesheet"/>
<link href="/web/static/lib/bootstrap/css/bootstrap.css" rel="stylesheet"/>
</t>
<t t-set="body_classname" t-value="'oe_single_form'"/>
<div class="oe_single_form_container modal-content">
<div class="oe_single_form_logo">
@ -54,6 +58,14 @@
</div>
<hr/>
<t t-raw="0"/>
<div class="oe_single_form_footer" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="oe_login_manage_db" t-attf-href="/web/database/manager{{ '?debug' if debug else '' }}">Manage Databases</a>
<span class="oe_footer_seperator"> | </span>
</t>
<a href="http://www.openerp.com" target="_blank">Powered by <span>OpenERP</span></a>
</div>
</div>
</t>
</template>
@ -79,22 +91,7 @@
<template id="web.login" name="Login">
<t t-call="web.login_layout">
<t t-set="head">
<t t-foreach="css" t-as="css_file">
<link rel="stylesheet" t-att-href="css_file"/>
</t>
<t t-foreach="js" t-as="js_file">
<script type="text/javascript" t-att-src="js_file"></script>
</t>
<script type="text/javascript">
$(function() {
var s = new openerp.init(<t t-raw="modules"/>);
var login_form = new openerp.web.LoginForm($('.oe_login_form'));
});
</script>
</t>
<form class="oe_login_form" role="form" t-attf-action="/web/login{{ '?debug' if debug else '' }}" method="post">
<form class="oe_login_form" role="form" t-attf-action="/web/login{{ '?debug' if debug else '' }}" method="post" onsubmit="this.action = this.action + location.hash">
<t t-call="web.database_select"/>
@ -121,14 +118,6 @@
</div>
</form>
<div class="oe_single_form_footer" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="oe_login_manage_db" t-attf-href="/web/database/manager{{ '?debug' if debug else '' }}">Manage Databases</a>
<span class="oe_footer_seperator"> | </span>
</t>
<a href="http://www.openerp.com" target="_blank">Powered by <span>OpenERP</span></a>
</div>
</t>
</template>