ó
ž9^c           @   sl   d  Z  d d l m Z d d l m Z d d l m Z m Z d d l m	 Z	 d Z
 d e f d     YZ d	 S(
   sÆ   
set_fake_passwords.py

    Reset all user passwords to a common value. Useful for testing in a
    development environment. As such, this command is only available when
    setting.DEBUG is True.

iÿÿÿÿ(   t   settings(   t   get_user_model(   t   BaseCommandt   CommandError(   t   signalcommandt   passwordt   Commandc           B   s3   e  Z d  e f Z e Z d   Z e d    Z RS(   sG   DEBUG only: sets all user passwords to a common value ("%s" by default)c      
   C   s^   t  t |   j |  | j d d d d t d d d d | j d	 d d
 d t d d d  S(   Ns   --promptt   destt   prompt_passwdt   defaultt   actiont
   store_truet   helps2   Prompts for the new password to apply to all userss
   --passwordt   default_passwds   Use this as default password.(   t   superR   t   add_argumentst   add_argumentt   Falset   DEFAULT_FAKE_PASSWORD(   t   selft   parser(    (    sZ   /tmp/pip-unpacked-wheel-a0M10Y/django_extensions/management/commands/set_fake_passwords.pyR      s    c         O   sª   t  j s t d   n  | d rV d d l m } | d  } | s` t d   q` n
 | d } t   } |   } | j |  | j j   j d | j	  } d	 | GHd  S(
   Ns   Only available in debug modeR   iÿÿÿÿ(   t   getpasss
   Password: s   You must enter a valid passwordR   R   s   Reset %d passwords(
   R    t   DEBUGR   R   R   t   set_passwordt   objectst   allt   updateR   (   R   t   argst   optionsR   t   passwdt   Usert   usert   count(    (    sZ   /tmp/pip-unpacked-wheel-a0M10Y/django_extensions/management/commands/set_fake_passwords.pyt   handle#   s    	

		(	   t   __name__t
   __module__R   R   R   t   requires_system_checksR   R   R!   (    (    (    sZ   /tmp/pip-unpacked-wheel-a0M10Y/django_extensions/management/commands/set_fake_passwords.pyR      s   	N(   t   __doc__t   django.confR    t   django.contrib.authR   t   django.core.management.baseR   R   t"   django_extensions.management.utilsR   R   R   (    (    (    sZ   /tmp/pip-unpacked-wheel-a0M10Y/django_extensions/management/commands/set_fake_passwords.pyt   <module>	   s   