[MERGE] auth_signup res.users improve display of invitation and reset password
bzr revid: al@openerp.com-20130314223326-b0j801ndgg1ru1lr
This commit is contained in:
commit
f883706c17
|
@ -161,14 +161,12 @@ class res_users(osv.Model):
|
|||
def _get_state(self, cr, uid, ids, name, arg, context=None):
|
||||
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')
|
||||
res[user.id] = ('active' if user.login_date else 'new')
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'state': fields.function(_get_state, string='Status', type='selection',
|
||||
selection=[('new', 'Never Connected'), ('active', 'Activated'), ('reset', 'Invitation Pending')]),
|
||||
selection=[('new', 'Never Connected'), ('active', 'Activated')]),
|
||||
}
|
||||
|
||||
def signup(self, cr, uid, values, token=None, context=None):
|
||||
|
@ -268,16 +266,7 @@ class res_users(osv.Model):
|
|||
if mail_state and mail_state['state'] == 'exception':
|
||||
raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'name': '_(Server Notification)',
|
||||
'tag': 'action_notify',
|
||||
'params': {
|
||||
'title': 'Mail Sent to: %s' % user.name,
|
||||
'text': 'You can reset the password by yourself using this <a href=%s>link</a>' % user.partner_id.signup_url,
|
||||
'sticky': True,
|
||||
}
|
||||
}
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, values, context=None):
|
||||
# overridden to automatically invite user to sign up
|
||||
|
|
|
@ -17,12 +17,26 @@
|
|||
<header>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<div class="oe_form_box_info oe_text_center" attrs="{'invisible': [('signup_valid', '!=', True)]}">
|
||||
<p attrs="{'invisible': [('state', '!=', 'active')]}">
|
||||
<b>A password reset has been requested for this user. An email containing the following link has been sent:</b>
|
||||
</p>
|
||||
<p attrs="{'invisible': [('state', '!=', 'new')]}">
|
||||
<b>An invitation email containing the following subscription link has been sent:</b>
|
||||
</p>
|
||||
<p><field class="oe_inline" name="signup_url" widget="url"/></p>
|
||||
<field name="signup_valid" invisible="1"/>
|
||||
</div>
|
||||
</xpath>
|
||||
<!-- add Reset Password button -->
|
||||
<xpath expr="//div[@class='oe_right oe_button_box']" position="replace">
|
||||
<div class="oe_right oe_button_box">
|
||||
<button string="Send reset password instructions by email"
|
||||
type="object" name="action_reset_password" />
|
||||
<button string="Send reset password link by email"
|
||||
type="object" name="action_reset_password"
|
||||
attrs="{'invisible': [('state', '!=', 'active')]}"/>
|
||||
<button string="Send an invitation email"
|
||||
type="object" name="action_reset_password" context="{'create_user': 1}"
|
||||
attrs="{'invisible': [('state', '!=', 'new')]}"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue