Subversion Repositories SmartDukaan

Rev

Rev 494 | Rev 766 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 494 Rev 759
Line 5... Line 5...
5
'''
5
'''
6
from shop2020.helpers.impl import DataAccessor
6
from shop2020.helpers.impl import DataAccessor
7
from shop2020.helpers.impl.DataAccessor import getSubstitutedMessage, getMessage,\
7
from shop2020.helpers.impl.DataAccessor import getSubstitutedMessage, getMessage,\
8
    updateMessage, addMessage, add_user, authenticate_user, delete_user, update_password,\
8
    updateMessage, addMessage, add_user, authenticate_user, delete_user, update_password,\
9
    initialize
9
    initialize
-
 
10
from shop2020.helpers.impl.DataService import LogisticsUser
-
 
11
from shop2020.thriftpy.utils.ttypes import HelperServiceException
-
 
12
from shop2020.helpers.impl.Converters import to_t_luser
10
 
13
 
11
class HelperServiceHandler():
14
class HelperServiceHandler():
12
    
15
    
13
 
16
 
14
    def __init__(self):
17
    def __init__(self):
Line 90... Line 93...
90
         - oldPassword
93
         - oldPassword
91
         - newPassword
94
         - newPassword
92
        """
95
        """
93
        update_password(username, oldPassword, newPassword)
96
        update_password(username, oldPassword, newPassword)
94
    pass
97
    pass
-
 
98
 
-
 
99
    def authenticateLogisticsUser(self, username, password):
-
 
100
        """
-
 
101
        Returns the LogisticsUser struct associated with the given username and password if they match.
-
 
102
        Throws an exception otherwise.
-
 
103
        
-
 
104
        Parameters:
-
 
105
         - username
-
 
106
         - password
-
 
107
        """
-
 
108
        try:
-
 
109
            luser = LogisticsUser.get_by(username=username, password=password)
-
 
110
            return to_t_luser(luser)
-
 
111
        except:
-
 
112
            raise HelperServiceException(101, "No such user")
95
113