Add an API token to the user profile that is automatically generated and regeneratable

Review Request #4156 — Created May 20, 2013 and discarded

Information

Review Board
master

Reviewers

This (the API token) will not yet do anything except for exist.
The patch to use this will come soon.

 
Description From Last Updated

Here, and other places, can you use "api_token" instead of "apitoken"?

chipx86chipx86

Blank line on both sides of this.

chipx86chipx86

This will create a random password once per thread (expensive!) and then make that the default for any users created …

chipx86chipx86

Does a @staticmethod work instead of a @classmethod? If not, just make this a function outside the class. In fact, …

chipx86chipx86

This would then go away.

chipx86chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/accounts/views.py
        reviewboard/accounts/models.py
        reviewboard/accounts/forms.py
      Ignored Files:
        reviewboard/templates/accounts/prefs.html
    
    
  2. 
      
PU
chipx86
  1. 
      
  2. reviewboard/accounts/forms.py (Diff revision 1)
     
     
    Show all issues
    Here, and other places, can you use "api_token" instead of "apitoken"?
  3. reviewboard/accounts/forms.py (Diff revision 1)
     
     
     
    Show all issues
    Blank line on both sides of this.
  4. reviewboard/accounts/models.py (Diff revision 1)
     
     
    Show all issues
    This will create a random password once per thread (expensive!) and then make that the default for any users created on that thread.
    
    Instead, you want to have this take a function that will be called, which will then call make_random_password(32).
    
    I suggest making this a @classmethod on Profile called generate_api_token().
    
    You can then use this function in the form instead of duplicating the make_random_password call, so that we don't repeat the logic.
  5. 
      
PU
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/accounts/views.py
        reviewboard/accounts/models.py
        reviewboard/accounts/forms.py
      Ignored Files:
        reviewboard/templates/accounts/prefs.html
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/accounts/models.py (Diff revision 2)
     
     
     
     
    Show all issues
    Does a @staticmethod work instead of a @classmethod?
    
    If not, just make this a function outside the class.
    
    In fact, if there's going to be any other functions that deal with API tokens in Review Board, this should just go in an apitokens.py.
  3. reviewboard/accounts/models.py (Diff revision 2)
     
     
    Show all issues
    This would then go away.
  4. 
      
PU
Review request changed
Status:
Discarded