如何在激活电子邮件中正确隐藏Parse.com URL?

时间:2016-01-27 08:45:00

标签: html parse-platform email-verification

我已将Parse.com集成到我的应用程序中,因此我设法注册并使用我的应用程序登录到Parse.com后端。

我还启用了设置 - >电子邮件 - >电子邮件设置 - > 验证用户电子邮件

新用户将收到一封包含以下激活链接的电子邮件: https://www.parse.com/apps/testemaillogin/verify_email?token=C6MDk6PBgegdfgH1boMPj&username=name%40email.com

Parse.com提供隐藏Parse.com网址:

  

将附件上传到您的服务器并输入其地址   在下面,您可以隐藏用户的parse.com。此页面是iframe   对于Parse来说,让你的域成为我们后端的前端。

<!DOCTYPE html>
<html>
<!-- This page is a passthrough frame used to host a parse.com experience from your server.
     If you choose to use this feature, be sure to tell Parse where you put this page in your
     app settings page.
     In general, there should be no reason to edit the contents of this page -->
<head>
  <style type='text/css'>
    html {
      height: 100%;
    }
    .chromeless {
      width: 100%;
      height: 100%;
      left: 0px;
      top: 0px;
      border: 0px;
      margin: 0px;
      padding: 0px;
    }
    .scrollable {
      overflow: auto;
    }
    .noscroll {
      overflow: hidden;
    }
    h1, p {
      padding: 15px;
      color: #0067AB;
      font: inherit;
      font-family: 'Open Sans', 'Helvetica Neue', Helvetica;
    }
    h1 {
      font-size: 30px;
      font-weight: 600;
    }
  </style>
  <script language='javascript' type='text/javascript'><!--

    window.onload = function() {
      // When there are query strings, this page is being used to pass content onto parse. Create
      // the iframe to do so. Forwards relevant query parameters onto the iFrame.
      if (window.location.search) {
        var urlParams = {};
        (function () {
            var pair, // Really a match. Index 0 is the full match; 1 & 2 are the key & val.
                tokenize = /([^&=]+)=?([^&]*)/g,
                // decodeURIComponents escapes everything but will leave +s that should be ' '
                re_space = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); },
                // Substring to cut off the leading '?'
                querystring = window.location.search.substring(1);

            while (pair = tokenize.exec(querystring))
               urlParams[re_space(pair[1])] = re_space(pair[2]);
        })();

        var base = 'https://www.parse.com';
        var link = '';
        var query = '';
        for (param in urlParams) {
          if (param == 'link') {
            link = urlParams['link'];
          } else {
            if (query != '') {
              query += "&";
            }
            query += param + '=' + encodeURIComponent(urlParams[param]);
          }
        }

        // Ensure there's a leading slash to avoid open redirect
        if (link.charAt(0) !== "/") {
          link = "/" + link;
        }

        var iframe = document.createElement('iframe');
        iframe.setAttribute('src', base + link + '?' + query);
        iframe.setAttribute('class', 'chromeless scrollable');
        document.getElementById('content').appendChild(iframe);

      // Otherwise, this page is likely being viewed by the app owner. Explain how to use it.
      } else {
        document.getElementById('content').innerHTML = 
          '<h1>This page lets you host Parse.com content from your own domain.</h1>' +
          '<p>Right click <a href="' + encodeURI(window.location.pathname) + '">here</a> to save this page. ' +
          'Upload it to your own website and paste the URL in the "Parse Frame URL" ' +
          'app settings at Parse.com.</p>';
      }
    }
    //-->
  </script>
</head>
<body class='chromeless noscroll'>
  <noscript>We apologize, but user management requires javascript</noscript>
  <div id='content' class='chromeless noscroll'></div>
</body>
</html>

我将该文件重命名为 parse.html 并将其上传至 http://my.space.com/parse.html

然后我进入了下面 Parse.com - &gt;设置 - &gt;电子邮件 - &gt;隐藏Parse.com网址 - &gt;解析帧URL 上面提到的短语: http://my.space.com/parse.html

现在,我的电子邮件中的激活链接如下:

  

http://my.space.com/parse.html?link=%2Fapps%2testemaillogin%2Fverify_email&token=BPkcfIrEfvcnbj6uDnFsdfpWI&username=name%40email.com

正如您可以看到的那样,

  

https://www.parse.com/apps/testemaillogin/verify_email?token=C6MDk6PdedgdfgH1boMPj&username=name%40email.com

网址中的/%2F替换(如testemaillogin和verify_email之间)

当我点击新的激活链接时,没有任何反应 - &gt;我的Parse.com后端仍然告诉我 emailVerfication 字段 false

我做错了什么?

编辑,只是为了完整性:当我只将服务器输入到该设置字段时 http://my.space.com?link=%2Fapps%2Ftestemaillogin%2Fverify_email&token=wyFHdG4iQeqAcJ8I3to4UbPII&username=name%40email.com

我明白了:

  

403禁止       代码:AccessDenied       消息:访问被拒绝       RequestId:775E40B2F6002281       HostId:t34pG3CX5JBDRjnm0MfvlU7J7Ox9pOCYNTf44oTw3JMbolYOMZ2c7r2yyuyRzH0S3Cxvc =   尝试检索自定义错误文档时发生错误       代码:AccessDenied       消息:访问被拒绝

0 个答案:

没有答案