<s> """<STR_LIT>""" <EOL> from django import forms <EOL> from django . contrib import auth <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> class SudoForm ( forms . Form ) : <EOL> """<STR_LIT>""" <EOL> password = forms . CharField ( label = _ ( '<STR_LIT>' ) , widget = forms . PasswordInput ) <EOL> def __init__ ( self , user , * args , ** kwargs ) : <EOL> self . user = user <EOL> super ( SudoForm , self ) . __init__ ( * args , ** kwargs ) <EOL> def clean_password ( self ) : <EOL> try : <EOL> username = self . user . get_username ( ) <EOL> except AttributeError : <EOL> username = self . user . username <EOL> if auth . authenticate ( username = username , password = self . data [ '<STR_LIT:password>' ] ) : <EOL> return self . data [ '<STR_LIT:password>' ] <EOL> raise forms . ValidationError ( _ ( '<STR_LIT>' ) ) </s>
