mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-25 07:27:04 +00:00
Fix login using QR code
This commit is contained in:
@@ -23,14 +23,26 @@ async function UIWindowLoginInProgress(options){
|
||||
return new Promise(async (resolve) => {
|
||||
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="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;
|
||||
font-size: 20px;
|
||||
font-size: 17px;
|
||||
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
|
||||
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>`;
|
||||
|
||||
|
||||
@@ -3187,7 +3187,6 @@ fieldset[name=number-code] {
|
||||
}
|
||||
|
||||
.login-progress {
|
||||
height: 200px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
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;
|
||||
transform: translate(-50%) !important;
|
||||
height: initial !important;
|
||||
|
||||
@@ -393,6 +393,8 @@ window.initgui = async function(options){
|
||||
else if(window.url_query_params.has('auth_token')){
|
||||
let query_param_auth_token = window.url_query_params.get('auth_token');
|
||||
|
||||
puter.setAuthToken(query_param_auth_token);
|
||||
|
||||
try{
|
||||
whoami = await puter.os.user();
|
||||
}catch(e){
|
||||
|
||||
Reference in New Issue
Block a user