This PR makes email optional when registering users on the server. Email is still required when a user registers using the CLI, but other clients can omit it.
Implementation notes
We shouldn't need a database migration for this change because the email field was already optional in the User model:
In other places in the code, for example recovery using email, we already assume a user may not have an associated email and error handling where necessary. The recovery code checks for email here:
This feature can be tested locally with a PUT request to http://runfission.test:1337/v2/api/user and a body that looks something like
{
"username": "testuser"
}
The request must be authorized with a bearer token that contains a new user DID as its issuer and the Fission server DID (did:key:z6MkgYGF3thn8k1Fv4p4dWXKtsXCnLH7q9yw4QgNPULDmDKB) as its audience.
The test should be repeated a second time with an email in the body
Summary
This PR implements the following features
This PR makes email optional when registering users on the server. Email is still required when a user registers using the CLI, but other clients can omit it.
Implementation notes
We shouldn't need a database migration for this change because the email field was already optional in the User model:
https://github.com/fission-suite/fission/blob/afaae0dc5f83f4e35a3d4fdbdea2608a8d49bef8/fission-web-server/library/Fission/Web/Server/Models.hs#L71
In other places in the code, for example recovery using email, we already assume a user may not have an associated email and error handling where necessary. The recovery code checks for email here:
https://github.com/fission-suite/fission/blob/afaae0dc5f83f4e35a3d4fdbdea2608a8d49bef8/fission-web-server/library/Fission/Web/Server/Handler/User/Email.hs#L51-L52
Test plan (required)
This feature can be tested locally with a
PUT
request tohttp://runfission.test:1337/v2/api/user
and a body that looks something likeThe request must be authorized with a bearer token that contains a new user DID as its issuer and the Fission server DID (
did:key:z6MkgYGF3thn8k1Fv4p4dWXKtsXCnLH7q9yw4QgNPULDmDKB
) as its audience.The test should be repeated a second time with an email in the body
It's also worth checking that CLI continues to work with these changes.
Closing issues
Closes #616
After Merge