Commit 36b2f8c1e7aba8050b4b92513ccac8a7add88fcd

Authored by Andrey Karpikov
1 parent 316d3685

add apple auth button

... ... @@ -187,15 +187,6 @@ module Kanjai
187 187 end
188 188 end
189 189
190   - str = "<meta name='appleid-signin-client-id' content='com.appdocks8'>"
191   - str += "<meta name='appleid-signin-scope' content='email name'>"
192   - str += "<meta name='appleid-signin-redirect-uri' content='https://www.appdocks8.com/register'>"
193   - str += "<meta name='appleid-signin-state' content='#{session[:state]}'>"
194   - str += "<meta name='appleid-signin-nonce' content='#{session[:nonce]}'>"
195   - str += "<meta name='appleid-signin-use-popup' content='true'>"
196   -
197   - layer.gsub!('</head>', str + '</head>')
198   -
199 190 return layer
200 191
201 192 end
... ...
1   -<div id="appleid-signin"></div>
  1 +<div id="appleid-signin" data-type="sign in"></div>
2 2 <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
3 3 <style>
4 4 #appleid-signin {
5 5 width: 210px;
6 6 height: 40px;
7 7 }
8   -</style>
\ No newline at end of file
  8 +</style>
  9 +<script type="text/javascript">
  10 + AppleID.auth.init({
  11 + clientId : 'com.appdocks8',
  12 + scope : 'email name',
  13 + redirectURI : 'https://www.appdocks8.com/register',
  14 + usePopup : true
  15 + });
  16 +
  17 + document.addEventListener('AppleIDSignInOnSuccess', (event) => {
  18 + alert('success');
  19 + // Handle successful response.
  20 + console.log(event.detail.data);
  21 + });
  22 +
  23 + // Listen for authorization failures.
  24 + document.addEventListener('AppleIDSignInOnFailure', (event) => {
  25 + alert('error');
  26 + console.log(event.detail.error);
  27 + });
  28 +
  29 +</script>
\ No newline at end of file
... ...
1 1 module Kanjai
2   - VERSION = "0.0.313"
  2 + VERSION = "0.0.314"
3 3 end
... ...