'manually validate/accept users flutter firebase

so im building an app which has 2 users(staff and student) and the staff must accept/verify users manually. thereby when the student registers/signs up this would show up as a request on the staff side then after the staff accepts or rejects the request which allows the studentto enter the app. i've already coded the sign-in sign up pages which looks very similar to this using firestore authentication.

the only solution i could think of is adding the user sign up info as a request and saving it under a firestore collection("registration requests") i though about how the password field might be an issue but i found that people used the flutter_string_encryption package to save the password as a .doc field. then when the staff accepts the request the method/ function .createUserWithEmailAndPassword(email: email, password: password) would be called but i don't know if this is the "correct" way of achieving this.honestly i have no idea how to tackle this problem. is there is any resource that tackle the same issue or any other way this could be archived?



Solution 1:[1]

You could implement a system whereby any student can create an account using .createUserWithEmailAndPassword() but the account has an associated flag/boolean which prevents them from viewing content until it is true.

E.g

  1. Student creates account using .createUserWithEmailAndPassword().
  2. Upon creating new user, create a FireStore document containing a boolean set to false if the account is unverified.
  3. Allow teachers to alter the FireStore record for students and change the boolean value to true upon verification.
  4. Dynamically display content to users based on wether the boolean in their FireStore record is set to true or false.

If this sounds feasible, I can provide more detail on the specific code if you're not familiar with the packages.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sylith