Changeset 771:76aae72ccaba


Ignore:
Timestamp:
05/06/16 18:10:55 (7 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Fixed the handling of the login information after registering (re #285)

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/flight.py

    r769 r771  
    13641364        if registrationOK:
    13651365            if result.loggedIn:
     1366                self._wizard._loginResult = result
    13661367                self._wizard.nextPage()
    13671368            else:
  • src/mlx/web.py

    r769 r771  
    678678
    679679            self._client.setCredentials(pilotID, registrationData.password)
    680             loginResult = self._client.login()
    681             result.loggedIn = loginResult is not None
     680            LoginRPC.setupLoginResult(result, self._client, pilotID,
     681                                      registrationData.password)
    682682
    683683        result.invalidData = \
     
    750750class LoginRPC(RPCRequest):
    751751    """An RPC-based login request."""
    752     def __init__(self, client, callback, pilotID, password):
    753         """Construct the login request with the given pilot ID and
     752    @staticmethod
     753    def setupLoginResult(result, client, pilotID, password):
     754        """Setup the login result with the given client, pilot ID and
    754755        password."""
    755         super(LoginRPC, self).__init__(client, callback)
    756 
    757         self._pilotID = pilotID
    758         self._password = password
    759 
    760     def run(self):
    761         """Perform the login request."""
    762         result = Result()
    763 
    764         self._client.setCredentials(self._pilotID, self._password)
    765         loginResult = self._client.login()
     756        loginResult = client.login()
    766757        result.loggedIn = loginResult is not None
    767758        if result.loggedIn:
    768             result.pilotID = self._pilotID
     759            result.pilotID = pilotID
    769760            result.pilotName = loginResult[0]
    770761            result.rank = loginResult[1]
    771             result.password = self._password
    772             result.flights = self._client.getFlights()
     762            result.password = password
     763            result.flights = client.getFlights()
    773764            if result.rank=="STU":
    774                 reply = self._client.getEntryExamStatus()
     765                reply = client.getEntryExamStatus()
    775766                result.entryExamPassed = reply[0]
    776767                result.entryExamLink = reply[1]
     
    778769                if reply[3]:
    779770                    result.rank = "FO"
     771
     772    def __init__(self, client, callback, pilotID, password):
     773        """Construct the login request with the given pilot ID and
     774        password."""
     775        super(LoginRPC, self).__init__(client, callback)
     776
     777        self._pilotID = pilotID
     778        self._password = password
     779
     780    def run(self):
     781        """Perform the login request."""
     782        result = Result()
     783
     784        self._client.setCredentials(self._pilotID, self._password)
     785        LoginRPC.setupLoginResult(result, self._client,
     786                                  self._pilotID, self._password)
    780787
    781788        return result
Note: See TracChangeset for help on using the changeset viewer.