Esempio n. 1
0
    def login_user(self, request):
        _message = None
        _status = self.interruption
        _userEntity = None
        try:
            _loginModel = loginModel()
            _loginEntity = loginEntity()
            _loginEntity.requestToClass(request)
            _userEntity = _loginModel.login_user(_loginEntity)
            if _userEntity is None:
                _status = self.failUser
                _message = self.messageFailUser
            else:
                _user_status = _userEntity.status
                if _user_status == self.status_user_to_be_confirmed:
                    _status = self.failUser
                    _message = self.messageUserToBeConfirmed
                    _userEntity = None

                if _user_status == self.status_user_refused:
                    _status = self.failUser
                    _message = self.messageUserToBeConfirmed
                    _userEntity = None

                if _user_status == self.status_user_confirmed:
                    _status = self.OK
                    _message = self.messageOK

        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _userEntity).toJSON()
Esempio n. 2
0
 def change_password_user_web(self, full_name, password):
     _full_name = None
     try:
         _model = loginModel()
         _full_name = _model.change_password_user_web(full_name, password)
     except (Exception) as e:
         print('error: ' + str(e))
     return _full_name
Esempio n. 3
0
 def login_user_web(self, full_name, password):
     _entity = None
     try:
         _model = loginModel()
         _entity = _model.login_user_web(full_name, password)
     except (Exception) as e:
         print('error: ' + str(e))
     return _entity
Esempio n. 4
0
 def get_load(self, index):
     _message = None
     _status = None
     _data = None
     try:
         _model = loginModel()
         _id_customer = index
         _data = _model.get_load(_id_customer)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
Esempio n. 5
0
 def login_customer(self, request):
     _message = None
     _status = self.interruption
     _userEntity = None
     try:
         _loginModel = loginModel()
         _loginEntity = loginEntity()
         _loginEntity.requestToClass(request)
         _userEntity = _loginModel.login_customer(_loginEntity)
         if _userEntity is None:
             _status = self.failUser
             _message = self.messageFailUser
         else:
             _status = self.OK
             _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _userEntity).toJSON()