瀏覽代碼

Fix login using QR code

jelveh 5 月之前
父節點
當前提交
63efee390a
共有 3 個文件被更改,包括 19 次插入6 次删除
  1. 16 4
      src/gui/src/UI/UIWindowLoginInProgress.js
  2. 1 2
      src/gui/src/css/style.css
  3. 2 0
      src/gui/src/initgui.js

+ 16 - 4
src/gui/src/UI/UIWindowLoginInProgress.js

@@ -23,14 +23,26 @@ async function UIWindowLoginInProgress(options){
     return new Promise(async (resolve) => {
     return new Promise(async (resolve) => {
         options = options ?? {};
         options = options ?? {};
 
 
-        let h = '';        
+        // get the profile picture of the user
+        let profile_pic 
+
+        if(options.user_info?.username){
+            profile_pic = await get_profile_picture(options.user_info?.username);
+        }
+
+        if(!profile_pic){
+            profile_pic = window.icons['profile.svg']
+        }
+
+        let h = '';
         h += `<div class="login-progress">`;
         h += `<div class="login-progress">`;
+            h += `<div class="profile-pic" style="background-color: #cecece; background-image: url('${profile_pic}'); width: 70px; height: 70px; background-position: center; background-size: cover; border-radius: 50px; margin-bottom: 15px; margin-top: 40px;"></div>`;
             h += `<h1 style="text-align: center;
             h += `<h1 style="text-align: center;
-            font-size: 20px;
+            font-size: 17px;
             padding: 10px;
             padding: 10px;
-            font-weight: 300; margin: -10px 10px 20px 10px;">Logging in as <strong>${options.user_info.email === null ? options.user_info.username : options.user_info.email}</strong></h1>`;
+            font-weight: 300; margin: -10px 10px 4px 10px;">Logging in as <strong>${options.user_info.email === null ? options.user_info.username : options.user_info.email}</strong></h1>`;
             // spinner
             // spinner
-            h +=`<svg style="float:left; margin-right: 7px;" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24"><title>circle anim</title><g fill="#212121" class="nc-icon-wrapper"><g class="nc-loop-circle-24-icon-f"><path d="M12 24a12 12 0 1 1 12-12 12.013 12.013 0 0 1-12 12zm0-22a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2z" fill="#212121" opacity=".4"></path><path d="M24 12h-2A10.011 10.011 0 0 0 12 2V0a12.013 12.013 0 0 1 12 12z" data-color="color-2"></path></g><style>.nc-loop-circle-24-icon-f{--animation-duration:0.5s;transform-origin:12px 12px;animation:nc-loop-circle-anim var(--animation-duration) infinite linear}@keyframes nc-loop-circle-anim{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}</style></g></svg>`;
+            h +=`<svg style="float:left; margin-right: 7px; margin-bottom: 30px;" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24"><title>circle anim</title><g fill="#212121" class="nc-icon-wrapper"><g class="nc-loop-circle-24-icon-f"><path d="M12 24a12 12 0 1 1 12-12 12.013 12.013 0 0 1-12 12zm0-22a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2z" fill="#212121" opacity=".4"></path><path d="M24 12h-2A10.011 10.011 0 0 0 12 2V0a12.013 12.013 0 0 1 12 12z" data-color="color-2"></path></g><style>.nc-loop-circle-24-icon-f{--animation-duration:0.5s;transform-origin:12px 12px;animation:nc-loop-circle-anim var(--animation-duration) infinite linear}@keyframes nc-loop-circle-anim{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}</style></g></svg>`;
 
 
         h += `</div>`;
         h += `</div>`;
 
 

+ 1 - 2
src/gui/src/css/style.css

@@ -3187,7 +3187,6 @@ fieldset[name=number-code] {
 }
 }
 
 
 .login-progress {
 .login-progress {
-    height: 200px;
     display: flex;
     display: flex;
     flex-direction: column;
     flex-direction: column;
     justify-content: center;
     justify-content: center;
@@ -4455,7 +4454,7 @@ fieldset[name=number-code] {
 
 
 }
 }
 
 
-.device-phone .window.window-qr, .device-phone .window.window-progress{
+.device-phone .window.window-qr, .device-phone .window.window-progress, .device-phone .window.window-login-progress{
     left: 50% !important;
     left: 50% !important;
     transform: translate(-50%) !important;
     transform: translate(-50%) !important;
     height: initial !important;
     height: initial !important;

+ 2 - 0
src/gui/src/initgui.js

@@ -393,6 +393,8 @@ window.initgui = async function(options){
     else if(window.url_query_params.has('auth_token')){
     else if(window.url_query_params.has('auth_token')){
         let query_param_auth_token = window.url_query_params.get('auth_token');
         let query_param_auth_token = window.url_query_params.get('auth_token');
 
 
+        puter.setAuthToken(query_param_auth_token);
+
         try{
         try{
             whoami = await puter.os.user();
             whoami = await puter.os.user();
         }catch(e){
         }catch(e){