Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: The new login UI #8865

Merged
merged 45 commits into from Mar 27, 2023
Merged

Feat: The new login UI #8865

merged 45 commits into from Mar 27, 2023

Conversation

xyhp915
Copy link
Collaborator

@xyhp915 xyhp915 commented Mar 21, 2023

TODOs

  • New UI for the login modal
    • sign in
    • sign up
    • forget the password
  • Tests on mobile

xyhp915 and others added 30 commits February 21, 2023 21:15
@github-actions github-actions bot added the :type/feature New feature label Mar 21, 2023
@xyhp915 xyhp915 requested review from andelf and cnrpman March 21, 2023 09:38
@@ -0,0 +1,142 @@
(()=>{function e(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function n(e){return e&&e.__esModule?e.default:e}var r={},o={},i=t.parcelRequire3974;null==i&&((i=function(e){if(e in r)return r[e].exports;if(e in o){var t=o[e];delete o[e];var n={id:e,exports:{}};return r[e]=n,t.call(n.exports,n,n.exports),n.exports}var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){o[e]=t},t.parcelRequire3974=i),i.register("4eZhh",(function(e,t){"use strict";Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.Sha256=void 0;var n=i("4q18G"),r=i("iOgRj"),o=i("8PhYj"),a=i("cI1IX"),s=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var i=new Uint8Array(r.BLOCK_SIZE);return i.set(t),i}(e),n=new Uint8Array(r.BLOCK_SIZE);n.set(t);for(var i=0;i<r.BLOCK_SIZE;i++)t[i]^=54,n[i]^=92;this.hash.update(t),this.outer.update(n);for(i=0;i<t.byteLength;i++)t[i]=0}}return e.prototype.update=function(e){if(!(0,a.isEmptyData)(e)&&!this.error)try{this.hash.update((0,a.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,n.__awaiter)(this,void 0,void 0,(function(){return(0,n.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();e.exports.Sha256=s})),i.register("4q18G",(function(t,n){e(t.exports,"__awaiter",(()=>r)),e(t.exports,"__generator",(()=>o)),e(t.exports,"__exportStar",(()=>i));function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function i(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}})),i.register("iOgRj",(function(e,t){"use strict";Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.MAX_HASHABLE_LENGTH=e.exports.INIT=e.exports.KEY=e.exports.DIGEST_LENGTH=e.exports.BLOCK_SIZE=void 0,e.exports.BLOCK_SIZE=64,e.exports.DIGEST_LENGTH=32,e.exports.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e.exports.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e.exports.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1})),i.register("8PhYj",(function(e,t){"use strict";Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.RawSha256=void 0;var n=i("iOgRj"),r=function(){function e(){this.state=Int32Array.from(n.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,r=e.byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>n.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===n.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%n.BLOCK_SIZE>=n.BLOCK_SIZE-8){for(var o=this.bufferLength;o<n.BLOCK_SIZE;o++)t.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<n.BLOCK_SIZE-8;o++)t.setUint8(o,0);t.setUint32(n.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(n.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(n.DIGEST_LENGTH);for(o=0;o<8;o++)i[4*o]=this.state[o]>>>24&255,i[4*o+1]=this.state[o]>>>16&255,i[4*o+2]=this.state[o]>>>8&255,i[4*o+3]=this.state[o]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=0;d<n.BLOCK_SIZE;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var f=this.temp[d-2],h=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,p=((f=this.temp[d-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;this.temp[d]=(h+this.temp[d-7]|0)+(p+this.temp[d-16]|0)}var m=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&u^~s&l)|0)+(c+(n.KEY[d]+this.temp[d]|0)|0)|0,g=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&o^r&i^o&i)|0;c=l,l=u,u=s,s=a+m|0,a=i,i=o,o=r,r=m+g|0}t[0]+=r,t[1]+=o,t[2]+=i,t[3]+=a,t[4]+=s,t[5]+=u,t[6]+=l,t[7]+=c},e}();e.exports.RawSha256=r})),i.register("cI1IX",(function(e,t){"use strict";Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.uint32ArrayFrom=e.exports.numToUint8=e.exports.isEmptyData=e.exports.convertToBuffer=void 0;var n=i("9bDQf");Object.defineProperty(e.exports,"convertToBuffer",{enumerable:!0,get:function(){return n.convertToBuffer}});var r=i("1RGZe");Object.defineProperty(e.exports,"isEmptyData",{enumerable:!0,get:function(){return r.isEmptyData}});var o=i("2xCFW");Object.defineProperty(e.exports,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var a=i("11P6Z");Object.defineProperty(e.exports,"uint32ArrayFrom",{enumerable:!0,get:function(){return a.uint32ArrayFrom}})})),i.register("9bDQf",(function(e,t){var n=i("N0o3H").Buffer;Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.convertToBuffer=void 0;var r=i("4Zaep"),o=void 0!==n&&n.from?function(e){return n.from(e,"utf8")}:r.fromUtf8;e.exports.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?o(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}})),i.register("N0o3H",(function(t,n){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we have yarn workspaces, could be nice to have this generated by a build step. tldraw does this with this script and then hooking in here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using npm hooks to pre-build dependency libraries is a great practice. However, the amplify/* library may not be frequently updated in the future, so I temporarily placed the build package separately in the resources/* directory to avoid taking up space in main.js. If there are frequent updates in the future, npm hooks can be used again.

Copy link
Contributor

@tiensonqin tiensonqin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great on both Electron and iOS! 🚢

@tiensonqin tiensonqin merged commit 95c5cba into master Mar 27, 2023
5 checks passed
@tiensonqin tiensonqin deleted the feat/the-new-login branch March 27, 2023 13:40
@Bad3r
Copy link
Collaborator

Bad3r commented Mar 28, 2023

@xyhp915, this is fantastic! By the way, if you go to Settings -> Features -> Login, it will follow the previous login workflow by directing you to logseq-prod AWS.

edit:
Fixed by #8917

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:type/feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants