Skip to content

Conversation

@ochan1
Copy link
Contributor

@ochan1 ochan1 commented Nov 5, 2021

This adds backend logic to allow for processing one-by-one accounts approved for verification

The original code returns an HTML for when the user is already successfully verified, but it can cause the Cloud Request code to error when the verify_user is called using the Cloud.prototype.request in Snap!'s cloud.js since it assumes a JSON request

This modification returns an OK JSON when an admin with a token of 0 approves a user

An additional field showing the status code of the verification is used to allow for messages to be shown why a user has failed verification upon detection of a certain status code (Verified, Already Verified, or Failed Verification)

This does not preprocess users one by one but does show which users fall under each of the three categories

This was made in conjunction with snap-cloud/SnapSite#111, but this Pull Request is not dependent on that one (but the SnapSite Pull Request is dependent on this snapCloud Pull Request)

-- admins can verify people without the need of a token
if self.params.token == '0' then assert_admin(self)
if self.queried_user.verified then
return okResponseWithStatusCode('User ' .. self.queried_user.username ..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, what's the reason for the new method, and the 'Already Verified' argument? The status_code argument of the jsonResponse method is meant to be a HTTP Status code, in this case it should always be 200.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was meant to be a message representing if the user was verified successfully or already verified, so the bulk verify can let the verifying person know who got verified or who was already verified
There isn't really a way of distinguishing between either one unless one were to use the message string, which is prone to be modified in the future since it is a message

I changed the name to make it less confusing between a Request status code and the Status of reaching this point of the code (I called it the State Message)

@cycomachead cycomachead deleted the branch snap-cloud:master October 8, 2025 07:29
@cycomachead cycomachead closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants