mirror of
				https://github.com/gristlabs/grist-core.git
				synced 2025-06-13 20:53:59 +00:00 
			
		
		
		
	(core) Fix WelcomePage to use an explicit action URL, and parse submitted body in time to log it with errors.
Test Plan: Tested manually that "Preflight" error goes away in Safari. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2644
This commit is contained in:
		
							parent
							
								
									0b1aa22ad9
								
							
						
					
					
						commit
						ad7be0fd8d
					
				@ -77,7 +77,7 @@ export class WelcomePage extends Disposable {
 | 
			
		||||
 | 
			
		||||
    return form = dom(
 | 
			
		||||
      'form',
 | 
			
		||||
      { method: "post" },
 | 
			
		||||
      { method: "post", action: location.href },
 | 
			
		||||
      handleSubmit(),
 | 
			
		||||
      cssLabel('Your full name, as you\'d like it displayed to your collaborators.'),
 | 
			
		||||
      inputEl = cssInput(
 | 
			
		||||
@ -101,7 +101,7 @@ export class WelcomePage extends Disposable {
 | 
			
		||||
   */
 | 
			
		||||
  private _buildInfoForm(owner: MultiHolder) {
 | 
			
		||||
    const allFilled = Observable.create(owner, false);
 | 
			
		||||
    return forms.form({method: "post"},
 | 
			
		||||
    return forms.form({method: "post", action: location.href },
 | 
			
		||||
      handleSubmit(),
 | 
			
		||||
      (elem) => { setTimeout(() => elem.focus(), 0); },
 | 
			
		||||
      forms.text('Please help us serve you better by answering a few questions.'),
 | 
			
		||||
 | 
			
		||||
@ -972,6 +972,10 @@ export class FlexServer implements GristServer {
 | 
			
		||||
        let body: string|undefined;
 | 
			
		||||
        let permitKey: string|undefined;
 | 
			
		||||
        try {
 | 
			
		||||
          const user = getUser(req);
 | 
			
		||||
          const row = {...req.body, UserID: userId, Name: user.name, Email: user.loginEmail};
 | 
			
		||||
          body = JSON.stringify(mapValues(row, value => [value]));
 | 
			
		||||
 | 
			
		||||
          // Take an extra step to translate the special urlId to a docId. This is helpful to
 | 
			
		||||
          // allow the same urlId to be used in production and in test. We need the docId for the
 | 
			
		||||
          // specialPermit below, which we need to be able to write to this doc.
 | 
			
		||||
@ -985,10 +989,6 @@ export class FlexServer implements GristServer {
 | 
			
		||||
            throw new Error(`Can't resolve ${urlId}: ${docAuth.error}`);
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          const user = getUser(req);
 | 
			
		||||
          const row = {...req.body, UserID: userId, Name: user.name, Email: user.loginEmail};
 | 
			
		||||
          body = JSON.stringify(mapValues(row, value => [value]));
 | 
			
		||||
 | 
			
		||||
          permitKey = await this._docWorkerMap.setPermit({docId});
 | 
			
		||||
          const res = await fetch(await this.getHomeUrlByDocId(docId, `/api/docs/${docId}/tables/Responses/data`), {
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user