[MERGE] trunk-oauth-signin-rco (small improvements in modules auth_oauth, auth_reset_password, auth_signup)

bzr revid: rco@openerp.com-20121128093005-svt8s4mey2ow5qsc
This commit is contained in:
Raphael Collet 2012-11-28 10:30:05 +01:00
commit 20627fc8e5
3 changed files with 16 additions and 4 deletions

View File

@ -33,7 +33,9 @@ openerp.auth_oauth = function(instance) {
this.$(".oe_login_pane form ul").after(buttons);
},
on_oauth_sign_in: function(ev) {
ev.preventDefault();
if (ev) {
ev.preventDefault();
}
var index = $(ev.target).data('index');
var provider = this.oauth_providers[index];
var return_url = _.str.sprintf('%s//%s/auth_oauth/signin', location.protocol, location.host);

View File

@ -7,11 +7,17 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<!-- Reset Password button -->
<xpath expr="//sheet/*[1]" position="before">
<div class="oe_right oe_button_box">
<button string="Reset Password" type="object" name="action_reset_password"/>
<button string="Reset Password" type="object" name="action_reset_password"
help="Send a special url by email to make the user (re)set their password."/>
</div>
</xpath>
<!-- password is never required; one can use Reset Password -->
<field name="new_password" position="attributes">
<attribute name="attrs">{}</attribute>
</field>
</field>
</record>

View File

@ -150,8 +150,12 @@ class res_users(osv.Model):
_inherit = 'res.users'
def _get_state(self, cr, uid, ids, name, arg, context=None):
return dict((user.id, 'new' if not user.login_date else 'reset' if user.signup_token else 'active')
for user in self.browse(cr, uid, ids, context))
res = {}
for user in self.browse(cr, uid, ids, context):
res[user.id] = ('reset' if user.signup_valid else
'active' if user.login_date else
'new')
return res
_columns = {
'state': fields.function(_get_state, string='Status', type='selection',