Implement seed generating
This commit is contained in:
parent
6f7d02f7fc
commit
2d147d961c
2 changed files with 15 additions and 4 deletions
|
@ -293,8 +293,10 @@ Don’t forget to point AUTH_USER_MODEL to it. Do this before creating any migra
|
|||
|
||||
- [x] serialize / input request
|
||||
- [x] Make seed read only
|
||||
- [ ] Remove hard coded JSON
|
||||
- [ ] Implement registering of new entries
|
||||
- [x] Implement registering of new entries
|
||||
- [x] OTPSerializer: allow to read seed for admin
|
||||
- [x] Implement deleting entry
|
||||
- [ ] Remove hard coded JSON (?)
|
||||
- [ ] Use Custom authentication (?) - needs to have a user
|
||||
- [ ] Maybe we map name+realm == User (?)
|
||||
- name == name@realm
|
||||
|
@ -303,5 +305,3 @@ Don’t forget to point AUTH_USER_MODEL to it. Do this before creating any migra
|
|||
- custom auth method
|
||||
- [ ] Implement creating new "User"
|
||||
- by POST / Model based
|
||||
- [ ] Implement deleting "User"
|
||||
- [ ] OTPSerializer: allow to read seed for admin
|
||||
|
|
|
@ -9,6 +9,17 @@ class OTPSerializer(serializers.ModelSerializer):
|
|||
fields = ('name', 'realm', 'seed')
|
||||
read_only_fields = ('seed',)
|
||||
|
||||
def create(self, validated_data):
|
||||
print(validated_data)
|
||||
print("BEING CALLED??")
|
||||
name = validated_data.get('name')
|
||||
realm = validated_data.get('realm')
|
||||
|
||||
# validated_data
|
||||
seed = pyotp.random_base32()
|
||||
validated_data['seed'] = seed
|
||||
|
||||
return OTPSeed.objects.create(**validated_data)
|
||||
|
||||
class VerifySerializer(serializers.Serializer):
|
||||
name = serializers.CharField(max_length=128)
|
||||
|
|
Loading…
Reference in a new issue