def validate_passwordNew(self, attrs, source):
        # this will raise a ValidationError if password is invalid
        password_validation.validate_password(attrs[source])

        if self.context[
                'is_managed'] or not self.context['has_usable_password']:
            raise serializers.ValidationError('Not allowed to change password')

        return attrs
예제 #2
0
    def validate_passwordNew(self, attrs, source):
        # this will raise a ValidationError if password is invalid
        password_validation.validate_password(attrs[source])

        if self.context['is_managed']:
            raise serializers.ValidationError(
                'This account is managed and the password cannot be changed via Sentry.')

        return attrs
    def validate_passwordNew(self, attrs, source):
        # this will raise a ValidationError if password is invalid
        password_validation.validate_password(attrs[source])

        if self.context['is_managed']:
            raise serializers.ValidationError(
                'This account is managed and the password cannot be changed via Sentry.'
            )

        return attrs
예제 #4
0
    def validate_passwordNew(self, value):
        # this will raise a ValidationError if password is invalid
        password_validation.validate_password(value)
        user = self.context['user']

        if user.is_managed:
            raise serializers.ValidationError(
                'This account is managed and the password cannot be changed via Sentry.')

        return value
예제 #5
0
파일: accounts.py 프로젝트: yaoqi/sentry
 def clean_new_password(self):
     new_password = self.cleaned_data.get('new_password')
     if new_password:
         password_validation.validate_password(new_password)
     return new_password
예제 #6
0
파일: accounts.py 프로젝트: yaoqi/sentry
 def clean_password(self):
     password = self.cleaned_data['password']
     password_validation.validate_password(password)
     return password
예제 #7
0
파일: accounts.py 프로젝트: yuan1024/sentry
 def clean_new_password(self):
     new_password = self.cleaned_data.get('new_password')
     if new_password:
         password_validation.validate_password(new_password)
     return new_password
예제 #8
0
파일: accounts.py 프로젝트: yuan1024/sentry
 def clean_password(self):
     password = self.cleaned_data['password']
     password_validation.validate_password(password)
     return password
예제 #9
0
 def clean_new_password(self):
     new_password = self.cleaned_data['new_password']
     password_validation.validate_password(new_password)
     return new_password