parameters: (user)
return_statement: return True
docstring: Send a user an email with a new, auto-generated password.
  
      We cannot decrypt the current password stored with the user record,
      so create a new one, and send it to the user.
  
      This method is used within the forgotpassword form endpoint, but not
      as a user facing view.
  
      Parameters:
          user -- The django user whose password will be changed.
  
      Returns:
          True if the user was modified and notified successfully.
docstring_summary: Send a user an email with a new, auto-generated password.
docstring_tokens: Send a user an email with a new auto - generated password .
function: def emailpassword(user):
      """
      Send a user an email with a new, auto-generated password.
  
      We cannot decrypt the current password stored with the user record,
      so create a new one, and send it to the user.
  
      This method is used within the forgotpassword form endpoint, but not
      as a user facing view.
  
      Parameters:
          user -- The django user whose password will be changed.
  
      Returns:
          True if the user was modified and notified successfully.
      """
  
      newpw = ''.join([
          choice(
              'abcdefghjkmnopqrstuvwxyzABCDEFGHJKMNOPQRSTUVWXYZ023456789!@#$%^&*()-_=+'
          ) for i in range(8)
      ])
      context = {'user': user, 'new_password': newpw}
      template = loader.get_template('forgottenpassword.email')
  
      try:
          s = sha1()
          s.update(newpw)
          user.set_password(s.hexdigest())
          user.save()
      except:
          return False
  
      send_mail(
          _('Your Password Reset Request'),
          template.render(context),
          settings.EMAIL_HOST_USER, [user.email],
          fail_silently=False)
      return True
function_tokens: def emailpassword ( user ) : newpw = '' . join ( [ choice ( 'abcdefghjkmnopqrstuvwxyzABCDEFGHJKMNOPQRSTUVWXYZ023456789!@#$%^&*()-_=+' ) for i in range ( 8 ) ] ) context = { 'user' : user , 'new_password' : newpw } template = loader . get_template ( 'forgottenpassword.email' ) try : s = sha1 ( ) s . update ( newpw ) user . set_password ( s . hexdigest ( ) ) user . save ( ) except : return False send_mail ( _ ( 'Your Password Reset Request' ) , template . render ( context ) , settings . EMAIL_HOST_USER , [ user . email ] , fail_silently = False ) return True