jmapio / jmap-demo-webmail

Demo JMAP Webmail Client
MIT License
106 stars 20 forks source link

Demo not working on local system #18

Open marke123 opened 4 years ago

marke123 commented 4 years ago

After install the demo and trying to connect to a Fastmail account enabled for JMAP mail I get this error in the console when trying to login and login fails to do anything:

TypeError target[action] is not a function activate@http://localhost.example/jmap-demo-client/libs/Overture.js:12640:37

mildred commented 3 years ago

This is caused by previous error failing the initialisation:

TypeError account is undefined getStoreKey@https://localhost/jmap-webmail/libs/Overture.js:22216:32
getRecord@https://localhost/jmap-webmail/libs/Overture.js:22328:33
App.state.selectedMessage<.record<@https://localhost/jmap-webmail/app/state.js:263:23
sync@https://localhost/jmap-webmail/libs/Overture.js:4230:26
connect@https://localhost/jmap-webmail/libs/Overture.js:4060:14
initBindings@https://localhost/jmap-webmail/libs/Overture.js:4332:45
Obj@https://localhost/jmap-webmail/libs/Overture.js:6056:40
init@https://localhost/jmap-webmail/libs/Overture.js:28665:58
@https://localhost/jmap-webmail/app/state.js:257:29
invoke@https://localhost/jmap-webmail/libs/Overture.js:3499:35
@https://localhost/jmap-webmail/app/state.js:9:11
mildred commented 3 years ago

Store.prototype.getPrimaryAccountIdForType() returns undefined, which may be normal (no account before login) but it crashes initialization because getRecord() cannot record to store without an account id.

mildred commented 3 years ago

When App.state.selectedMessage gets initialized, it will want to find the App.state.emailId and store it globally, which mixes it with the account Id, which does not exists since login is not yet performed.

mildred commented 3 years ago

The solution is probably to provide a login page outside of the webmail and fetch the login user/pass programmatically in store.js.

amessina commented 2 months ago

It's been quite a while since this was reported, however I'm looking to do some testing directly with Cyrus-IMAP behind an Apache httpd instance (with Basic auth) and am encountering this same issue.

I'm wondering if you could elaborate on how you may have resolved this login issue. I guess I'm not sure where to begin in the code.

amessina commented 2 months ago

I was able to get a little further; in app/state.js I needed to update the following to match my server.

App.state = new O.Router({

    baseUrl: location.origin === 'https://example.com' ?
        'https://example.com/jmap-demo-webmail/' :
        location.origin + '/',
App.credentials = new O.LocalStorage( 'credentials', false, {
    server: 'https://example.com/.well-known/jmap',
    username: '',
    password: '',
});