[MERGE] Fix Reset Password and Anonymous Language
bzr revid: vta@openerp.com-20121231153924-b1l9j2hw0uw3amtj
This commit is contained in:
@@ -249,14 +249,13 @@ class res_users(osv.Model):
|
||||
assert template._name == 'email.template'
|
||||
for user in self.browse(cr, uid, ids, context):
|
||||
if not user.email:
|
||||
raise osv.except_osv(_("Cannot send email: user has no email address."), user.name)
|
||||
m = osv.except_osv(_("Cannot send email: user has no email address."), user.name)
|
||||
mail_id = self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context)
|
||||
mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context)
|
||||
if mail_state and mail_state == 'exception':
|
||||
raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
|
||||
m = osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
|
||||
else:
|
||||
raise osv.except_osv(_("Mail sent to:"), user.email)
|
||||
|
||||
m = osv.except_osv(_("Mail sent to:"), user.email)
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, values, context=None):
|
||||
|
||||
@@ -144,6 +144,7 @@ openerp.auth_signup = function(instance) {
|
||||
self.show_error(result.error);
|
||||
} else {
|
||||
super_.apply(self, [ev]);
|
||||
window.location = "/#action=login";
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -16,19 +16,27 @@ openerp.portal_anonymous = function(instance) {
|
||||
// then don't change session.user_context.lang
|
||||
if (langs.length > 0) {
|
||||
// Try to get the right user preference in the browser, else
|
||||
// get the first returned language
|
||||
// get the shortest language returned ('xx' country code) or
|
||||
// just the first one
|
||||
var l = _.filter(langs, function(lang) { return lang.code === browser_lang || lang.iso_code === browser_lang; });
|
||||
if (!_.isEmpty(l)) {
|
||||
self.user_context.lang = l[0].code;
|
||||
} else {
|
||||
self.user_context.lang = langs.sort(function(a, b) {
|
||||
return a.length - b.length;
|
||||
})[0].code;
|
||||
l = _.filter(langs, function(lang) {
|
||||
return lang.iso_code === _.pluck(langs, 'iso_code')
|
||||
.sort(function(a, b) {
|
||||
return a.length - b.length;
|
||||
})[0];
|
||||
});
|
||||
self.user_context.lang = l[0].code;
|
||||
}
|
||||
}
|
||||
return self.rpc('/web/webclient/translations', { mods: self.module_list, lang: self.user_context.lang }).done(function(trans) {
|
||||
instance.web._t.database.set_bundle(trans);
|
||||
});
|
||||
});
|
||||
}
|
||||
return self._super();
|
||||
return this._super();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -36,9 +44,8 @@ openerp.portal_anonymous = function(instance) {
|
||||
start: function() {
|
||||
var self = this;
|
||||
return $.when(this._super()).then(function() {
|
||||
var params = $.deparam($.param.querystring());
|
||||
var dblist = self.db_list || [];
|
||||
if (!self.session.session_is_valid() && dblist.length === 1 && (!params.token || !params.login)) {
|
||||
if (!self.session.session_is_valid() && dblist.length === 1 && _.isEmpty(self.params)) {
|
||||
self.remember_credentials = false;
|
||||
// XXX get login/pass from server (via a rpc call) ?
|
||||
return self.do_login(dblist[0], 'anonymous', 'anonymous');
|
||||
@@ -85,7 +92,7 @@ openerp.portal_anonymous = function(instance) {
|
||||
},
|
||||
// Avoid browser preloading
|
||||
show_application: function() {
|
||||
var params = $.deparam($.param.querystring());
|
||||
var params = $.deparam($.param.fragment());
|
||||
if (!!params.token || !!params.login) {
|
||||
return this.show_login();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user