[FIX] auth_signup: move wizard trigger to login page
bzr revid: chs@openerp.com-20120806153832-0joy03c20y28bmx4
This commit is contained in:
parent
6f2582afd8
commit
ccbc0df1dd
|
@ -8,11 +8,14 @@
|
|||
'installable': True,
|
||||
'depends': ['auth_anonymous', 'base_setup'],
|
||||
'data': [
|
||||
'auth_signup.xml',
|
||||
'res_config.xml',
|
||||
'auth_signup.xml',
|
||||
'res_config.xml',
|
||||
],
|
||||
'js': [
|
||||
'static/src/js/auth_signup.js',
|
||||
'static/src/js/auth_signup.js',
|
||||
],
|
||||
'css': [
|
||||
'static/src/css/auth_signup.css',
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/auth_signup.xml',
|
||||
|
|
|
@ -54,4 +54,3 @@ class signup_signup(osv.TransientModel):
|
|||
if pw != cpw:
|
||||
return {'value': {'state': 'missmatch'}}
|
||||
return {'value': {'state': 'draft'}}
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
.openerp .oe_login .oe_login_pane ul.oe_signup a {
|
||||
color: #eeeeee;
|
||||
margin: 0 8px;
|
||||
}
|
||||
.openerp .oe_login .oe_login_pane ul.oe_signup a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
|
@ -1,19 +1,46 @@
|
|||
openerp.auth_signup = function(instance) {
|
||||
var _t = instance.web._t;
|
||||
|
||||
instance.web.UserMenu.include({
|
||||
instance.web.Login.include({
|
||||
start: function() {
|
||||
var self = this;
|
||||
this._super.apply(this, arguments);
|
||||
this.$element.find('a.oe_topbar_signup').click(function() {
|
||||
var p = self.getParent();
|
||||
var am = p.action_manager;
|
||||
am.do_action({
|
||||
type:'ir.actions.act_window',
|
||||
res_model: 'auth.signup',
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
name: 'Sign Up'
|
||||
});
|
||||
|
||||
this.$('a.oe_signup').click(function() {
|
||||
var db = self.$("form [name=db]").val();
|
||||
if (!db) {
|
||||
self.do_warn(_t("Login"), _t("No database selected!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
var cnx = instance.connection;
|
||||
if (cnx.session_is_valid()) {
|
||||
self._signup();
|
||||
} else {
|
||||
cnx.session_authenticate(db, 'anonymous', 'anonymous', true).then(function() {
|
||||
self._signup();
|
||||
}).fail(function(error, event) {
|
||||
console.log(error);
|
||||
// cannot log as anonymous or auth_signup not installed
|
||||
self.do_warn(_t('Sign Up'), _.str.sprintf(_t('Signup functionnality is not available for database %s'), db), true);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return this._super();
|
||||
|
||||
},
|
||||
|
||||
_signup: function() {
|
||||
this.do_action({
|
||||
type:'ir.actions.act_window',
|
||||
res_model: 'auth.signup',
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
name: 'Sign Up'
|
||||
}, function() {
|
||||
// mmh, no way to have access to dialog befor close...
|
||||
// TODO autolog user
|
||||
console.log('onclose', this, arguments);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,12 +3,14 @@
|
|||
-->
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-extend="UserMenu.auth_anonymous">
|
||||
<t t-jquery="a" t-operation="after">
|
||||
<a href="#" class="oe_user_menu oe_topbar_item oe_topbar_signup">
|
||||
<img class="oe_topbar_avatar" t-att-src="_s + '/web/static/src/img/user_menu_avatar.png'"/>
|
||||
Sign Up
|
||||
</a>
|
||||
<t t-extend="Login">
|
||||
<t t-jquery="form ul:first li:last" t-operation="after">
|
||||
<li>
|
||||
<a class="oe_signup" href="#">Sign Up</a>
|
||||
</li>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
|
||||
|
||||
</templates>
|
||||
|
|
Loading…
Reference in New Issue