Commit 36b2f8c1e7aba8050b4b92513ccac8a7add88fcd

Authored by Andrey Karpikov
1 parent 316d3685

add apple auth button

@@ -187,15 +187,6 @@ module Kanjai @@ -187,15 +187,6 @@ module Kanjai
187 end 187 end
188 end 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 return layer 190 return layer
200 191
201 end 192 end
1 -<div id="appleid-signin"></div> 1 +<div id="appleid-signin" data-type="sign in"></div>
2 <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script> 2 <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
3 <style> 3 <style>
4 #appleid-signin { 4 #appleid-signin {
5 width: 210px; 5 width: 210px;
6 height: 40px; 6 height: 40px;
7 } 7 }
8 -</style>  
  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>
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.313" 2 + VERSION = "0.0.314"
3 end 3 end