Exemple #1
0
 def preprocess(self):
     AppHandler.preprocess(self)
     self.html_param['url_scoutevent_top'] = self.makeAppLinkUrl(
         UrlMaker.scoutevent_top())
     self.html_param['url_scoutevent_scouttop'] = self.makeAppLinkUrl(
         UrlMaker.scoutevent())
     self.html_param['url_sp_gacha'] = self.makeAppLinkUrl(
         '/gacha?_gtype=stepup')
Exemple #2
0
 def preprocess(self):
     AppHandler.preprocess(self)
     self.__gachamaster_id = None
     self.__playdata = None
     self.__playcount = None
     self.__gachamaster = None
     self.__gachamasterstep = None
     self.__gachaseatmodels = None
     self.html_param['omake'] = {}
Exemple #3
0
 def preprocess(self):
     AppHandler.preprocess(self)
     self.__shopmaster_id = None
     self.__shopmaster = None
     self.__buydata = None
     self.__gachamaster_id = None
     self.__playdata = None
     self.__playcount = None
     self.__gachamaster = None
     self.__gachamasterstep = None
Exemple #4
0
    def checkUser(self):
        AppHandler.checkUser(self)

        if settings_sub.IS_LOCAL:
            return

        # 署名の検証を行う.
        # RSA公開鍵を生成する
        if self.osa_util.appparam.sandbox:
            cert = dmmpc.api.CERT_DEV
        else:
            cert = dmmpc.api.CERT_REL
        exponent = 65537
        public_key_long = long(cert, 16)
        public_key = RSA.construct((public_key_long, long(exponent)))

        parameters = {}
        for k, v in self.request.django_request.GET.items():
            parameters[k] = urllib.unquote(v)

        # クエリパラメータをつなげてハッシュを生成する
        oauth_request = oauth.OAuthRequest.from_request(self.request.method,
                                                        self.request.url,
                                                        parameters=parameters)
        signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1()
        _, raw = signature_method.build_signature_base_string(
            oauth_request, oauth.OAuthConsumer('dmm', ''), None)
        local_hash = hashlib.sha1(raw).digest()

        # シグネチャをBase64でデコードして公開鍵で複合化する
        oauth_request.parameters[
            'oauth_signature'] = self.request.django_request.GET[
                'oauth_signature']
        sig = base64.decodestring(
            urllib.unquote(oauth_request.get_parameter("oauth_signature")))
        remote_hash = public_key.encrypt(sig, '')[0][-20:]

        self.osa_util.logger.trace('local_hash :%s' %
                                   binascii.b2a_hex(local_hash))
        self.osa_util.logger.trace('remote_hash:%s' %
                                   binascii.b2a_hex(remote_hash))

        if local_hash == remote_hash:
            self.osa_util.logger.trace('rsa_sha1_check_ok?:True')
        else:
            self.osa_util.logger.trace('rsa_sha1_check_ok?:False')
            raise CabaretError(u'署名を確認できません',
                               code=CabaretError.Code.OAUTH_ERROR)
Exemple #5
0
    def preprocess(self):
        AppHandler.preprocess(self)
        model_mgr = self.getModelMgr()
        v_player = self.getViewerPlayer()

        # プレーヤーの本日の総売上を取得
        eventmaster = BackendApi.get_current_cabaclubrankeventmaster(
            model_mgr, using=settings.DB_READONLY)
        if eventmaster:
            rankingid = CabaClubRankEventMaster.makeID(v_player.id,
                                                       eventmaster.id)
            rankmaster = BackendApi.get_model(model_mgr,
                                              CabaClubEventRankMaster,
                                              rankingid,
                                              using=settings.DB_READONLY)
            self.html_param[
                'today_proceeds'] = rankmaster.today_proceeds if rankmaster else 0
        else:
            self.html_param['today_proceeds'] = 0
        self.html_param['url_cabaclub_top'] = self.makeAppLinkUrl(
            UrlMaker.cabaclubtop())
Exemple #6
0
 def preprocess(self):
     AppHandler.preprocess(self)
     self.__happeningraidset = None
     self.__prizelist = None
     self.__leaderlist = None
Exemple #7
0
 def processAppError(self, err):
     if err.code == CabaretError.Code.EVENT_CLOSED:
         url = UrlMaker.mypage()
         self.appRedirect(self.makeAppLinkUrlRedirect(url))
         return
     AppHandler.processAppError(self, err)
Exemple #8
0
 def preprocess(self):
     AppHandler.preprocess(self)
     self.__shopmaster_id = None
     self.__shopmaster = None
     self.__buydata = None
Exemple #9
0
 def preprocess(self):
     AppHandler.preprocess(self)
     self.__battleplayer = None
     self.__rankmaster = None