UMBC-CMSC447-Spring2017-Team5 / college-JUMP

https://lassa.xen.prgmr.com/collegejump/
GNU General Public License v3.0
0 stars 0 forks source link

Administrator interface to create new users #19

Closed alexander-bauer closed 7 years ago

alexander-bauer commented 7 years ago

General process:

  1. Add a UserInfo form in collegejump/forms.py
  2. Fill out the fields (here's documentation) by referencing data from the User model in collegejump/models.py. Don't take the ID from the form, and also use a PasswordField from WTForms. We can leave the mentor stuff for later. We want the name, email, and admin fields.
  3. Edit one of the templates to use the new form, see login.html for an example.
  4. Edit views.py to pass the semantic form info (see near form = LoginForm() from views.py) to the template
  5. Change the same views.py function to accept the POST method, as with the login form, and use the form.validate_on_submit() block to do the logic on receiving the form.
  6. Take the code from makeadmin in __main__.py for creating the user.

Bear in mind that the login is buggy at the moment, so testing might be a pain. To check what's in the User table in the database, you can use sqlite3 local.db 'SELECT * FROM user;'.

Mjacks3 commented 7 years ago

Hey @alexander-bauer, I've implemented this, but I'm unsure of if its been implement correctly (Latest Git Update). Few questions. It might be better to talk through this in person but I'll post here too.

  1. I assume I use the make admin function from part six to create a new user. If not, I have misunderstood that subtask. If so, is the call to that function made at the end of the views.py logic?
  2. Where does the command to use sqlite 3 to test the creation go exactly? I assume it should be in my same prompt window but that window is busy executing during the run.
alexander-bauer commented 7 years ago

@Mjacks3 I was actually pretty unclear on the makeadmin function, sorry! I meant that you should borrow the code from that function, rather than calling the function directly. We should remove that function as soon as we have another method to create the first admin.

As for the SQLite3 command, you can either open another terminal simultaneously, or run the SELECT command after stopping the Flask process. That command just queries the database, which persists.

Mjacks3 commented 7 years ago

Retroactively closing