<s> from passlib . hash import sha512_crypt <EOL> import ajenti <EOL> from ajenti . api import * <EOL> from base import UserSyncProvider <EOL> @ plugin <EOL> class AjentiSyncProvider ( UserSyncProvider ) : <EOL> id = '<STR_LIT>' <EOL> title = _ ( '<STR_LIT>' ) <EOL> allows_renaming = True <EOL> syncs_root = True <EOL> def test ( self ) : <EOL> pass <EOL> def check_password ( self , username , password ) : <EOL> if not username in ajenti . config . tree . users : <EOL> return False <EOL> type = '<STR_LIT>' <EOL> saved = ajenti . config . tree . users [ username ] . password <EOL> if '<STR_LIT:|>' in saved : <EOL> type , saved = saved . split ( '<STR_LIT:|>' ) <EOL> if type == '<STR_LIT>' : <EOL> hash = password <EOL> return hash == saved <EOL> elif sha512_crypt . identify ( saved ) : <EOL> return sha512_crypt . verify ( password , saved ) <EOL> def sync ( self ) : <EOL> pass </s>
