Exemplo n.º 1
0
 def getCredentialsByEmail(self, cemail):
     result = CredentialsDAO().getCredentialsByEmail(cemail)
     mapped_result = []
     if not result:
         return jsonify(Error="NOT FOUND"), 404
     else:
         for r in result:
             mapped_result.append(self.mapToUserDict(r))
         return jsonify(User=mapped_result)
Exemplo n.º 2
0
 def getUserByCredentials(self, args):
     print("HANDLER")
     cuser = args.get("cuser")
     cpassword = args.get("cpassword")
     print(cuser)
     print(cpassword)
     #cuser = json['cuser']
     #cpassword = json['cpassword']
     if cuser and cpassword:
         result = CredentialsDAO().getUserByCredentials(cpassword, cuser)
         mapped_result = []
         if not result:
             return jsonify(Error="NOT FOUND"), 404
         else:
             for r in result:
                 mapped_result.append(self.mapToDict(r))
             return jsonify(User=mapped_result), 201
     else:
         return jsonify(Error="Unexpected attributes in post request"), 404
Exemplo n.º 3
0
    def insertCredentialsJSON(self, json):
        ufirst_name = json.get('ufirst_name')

        ulast_name = json.get('ulast_name')

        cuser_name = json.get('cuser_name')

        cpassword = json.get('cpassword')

        cemail = json.get('cemail')

        #cphone = json.get('cphone');

        #udescription = json.get('udescription');

        if cuser_name and cpassword and cemail:
            cid = CredentialsDAO().insert(cuser_name, cpassword, cemail)
            mapped_result = self.buildUserDict(cid, cuser_name, cpassword,
                                               cemail)
            return jsonify(User=mapped_result), 201
        else:
            return jsonify(Error="Unexpected attributes in post request"), 404