Commit Graph

72 Commits

Author SHA1 Message Date
Andrew Nicolaou 37fcf46972 Public API: Create new project (fixes #1095) (#1106)
* Converts import script to use public API endpoints

The endpoints don't exist yet, but this is a good way to see how
the implementation of the data structures differ.

* Exposes public API endpoint to fetch user's sketches

* Implements public API delete endpoint

* Adds helper to create custom ApplicationError classes

* Adds create project endpoint that understand API's data structure

This transforms the nested tree of file data into a mongoose
Project model

* Returns '201 Created' to match API spec

* Removes 'CustomError' variable assignment as it shows up in test output

* transformFiles will return file validation errors

* Tests API project controller

* Tests toModel()

* Creates default files if no root-level .html file is provided

* Do not auto-generate a slug if it is provided

Fixes a bug where the slug was auto-generated using the sketch name,
even if a slug property had been provided.

* Validates uniqueness of slugs for projects created by the public API

* Adds tests for slug uniqueness

* Configures node's Promise implementation for mongoose (fixes warnings)

* Moves createProject tests to match controller location

* Adds support for code to ApplicationErrors

* deleteProject controller tests

* getProjectsForUser controller tests

- implements tests
- update apiKey tests to use new User mocks

* Ensure error objects have consistent property names

`message` is used as a high-level description of the errors
`detail` is optional and has an plain language explanation of the
individual errors
`errors` is an array of each individual problem from `detail` in a
machine-readable format

* Assert environment variables are provided at script start

* Version public API

* Expect "files" property to always be provided

* Fixes linting error

* Converts import script to use public API endpoints

The endpoints don't exist yet, but this is a good way to see how
the implementation of the data structures differ.

* Exposes public API endpoint to fetch user's sketches

* Implements public API delete endpoint

* Adds helper to create custom ApplicationError classes

* Adds create project endpoint that understand API's data structure

This transforms the nested tree of file data into a mongoose
Project model

* Returns '201 Created' to match API spec

* Removes 'CustomError' variable assignment as it shows up in test output

* transformFiles will return file validation errors

* Tests API project controller

* Tests toModel()

* Creates default files if no root-level .html file is provided

* Do not auto-generate a slug if it is provided

Fixes a bug where the slug was auto-generated using the sketch name,
even if a slug property had been provided.

* Validates uniqueness of slugs for projects created by the public API

* Adds tests for slug uniqueness

* Configures node's Promise implementation for mongoose (fixes warnings)

* Moves createProject tests to match controller location

* deleteProject controller tests

* Adds support for code to ApplicationErrors

* getProjectsForUser controller tests

- implements tests
- update apiKey tests to use new User mocks

* Ensure error objects have consistent property names

`message` is used as a high-level description of the errors
`detail` is optional and has an plain language explanation of the
individual errors
`errors` is an array of each individual problem from `detail` in a
machine-readable format

* Assert environment variables are provided at script start

* Version public API

* Expect "files" property to always be provided

* Fixes linting error

* Checks that authenticated user has permission to create under this namespace

Previously, the project was always created under the authenticated user's
namespace, but this not obvious behaviour.
2019-09-08 16:45:58 +02:00
Andrew Nicolaou b1bfb91f80 Serve assets from /:username/assets, redirecting old path 2019-08-24 13:38:01 +02:00
Andrew Nicolaou de5e1a9e8f Removes AdvancedSettingsView as functionality now in AccountView 2019-05-29 12:51:50 -04:00
Andrew Nicolaou 403234ae81 Moves API key creation to server 2019-05-29 12:51:50 -04:00
Vertmo db71a2b7c0 Added DB schema and backend logic for API keys creation and deletion 2019-05-29 12:51:50 -04:00
Vertmo 3d2a862d9d Added design of the API key page 2019-05-29 12:51:50 -04:00
Cassie Tarakajian 437ffba378
fixes #802 (#809) 2019-01-16 12:35:34 -05:00
Cassie Tarakajian 2902145ec2 for #733 2018-10-18 14:14:38 -04:00
Basile Pesin 996a1b988a Fixes #692 (#713)
* Got the basis covered, now I need to style all this

* Corrected and upgraded Share window

* Changed the routes again, and set correct design

* Made some of the requested changes

* Removed PreviewFrame errors

* Redesigned Preview Header

* Corrected style of the FullView

* Corrected most of the css mistakes

* Corrected logo size
2018-10-18 14:10:37 -04:00
Cassie Tarakajian 2307d89df7 for #727 2018-10-10 18:59:14 -04:00
Cassie Tarakajian 63be548f63 fix linting error 2018-05-30 14:23:11 -07:00
Liang Tang d5856ba923 Remove authorization from specific routes (#642)
* fixes #569

* update listObjectsInS3ForUser

* update client-side routes

* update aws controller

* update

* redirect to /login when unlogged in
2018-05-29 21:37:10 -07:00
Mr.tang 27d4013585 Fixes #520 (#538)
* Fix #520

* delete consoles

* restore

* return 404 from server side

* fix lint error

* add sketch check for user
2018-02-19 15:21:47 -05:00
Cassie Tarakajian daeed8749d
fixes #528 (#536) 2018-02-09 16:32:06 -05:00
Cassie Tarakajian c50f64c0f3 fix linting errors 2018-01-09 16:21:40 -05:00
Cassie Tarakajian fb1684ce4b add isAuthenticated middleware, add isAuthenticated middleware to certain routes, make all other routes consistent 2018-01-09 15:57:49 -05:00
Cassie Tarakajian 03eae2f1ef fixes #479 and fixes #449 2017-11-28 14:48:50 -05:00
Cassie Tarakajian c30aba8e78 fix lingering linting errors 2017-10-15 20:27:05 -07:00
Akarshit Wal 20bc8633d7 Login and signup page not visible after login (#431)
* Login and signup page not visible after login

* Redirect added on server side
2017-09-29 11:52:20 -07:00
Cassie Tarakajian 63b47319d4 fix merge conflict 2017-08-01 16:07:21 -04:00
Cassie Tarakajian e140702784 Create Asset List View and refactor overlay code (#356)
* start to create asset list

* begin refactoring overlay component to remove duplicate code

* refactoring of overlays, asset list styles

* changes to add size to asset list

* fixes to asset list

* handle case in which a user hasn't uploaded any assets

* fix bug in which asset list only grabbed first asset

* remove console.log

* update overlay exit styling to use icon mixin
2017-07-11 17:37:43 +02:00
Andrew Nicolaou 1dc0c22cb7 Email verification (#369)
* Re-introduce Email Verification code

Revert "Revert "Email verification""
This reverts commit d154d8bff259350523a0f139e844db96c43d2ee1.

* Uses MJML to generate Reset Password email

* Sends Password Reset and Email Confirmation emails using MJML template

* Sends verified status along with user data

* API endpoint for resending email verification confirmation

* Displays verification status on Account page and allows resending

* Send back error string

* Passes email address through to sign/verify helper

* Uses enum-style object to set verified state

* Sends minimal info when user verifies since it can be done without login

* Provides /verify UI and sends confirmation token to API

* Better name for JWT secret token env var

* Adds mail config variables to Readme

* Encrypts email address in JWT

The JWT sent as the token in the Confirm Password URL
can be unencoded by anyone, although it's signature can only
be verified by us. To ensure that no passwords are leaked,
we encrypt the email address before creating the token.

* Removes unused mail templates

* Resets verified flag when email is changed and sends another email

* Moves email confirmation functions next to each other

* Extracts random token generator to helper

* Moves email confirmation actions into Redux

- updates the AccountForm label with a message to check inbox
- show status when verifying email token

* Uses generated token stored in DB for email confirmation

* Sets email confirmation status to verified if logging in from Github

* Sends email using new method on account creation

* Fixes linting errors

* Removes replyTo config
2017-06-26 12:48:28 -04:00
Zach Rispoli 396fc701c7 Fix issue with serving assets inside folders 2017-06-12 13:49:45 -04:00
Zach Rispoli 61afce46ed Server can serve individual assets from projects (fixes #212, fixes #219) 2017-06-01 00:08:11 -04:00
Cassie Tarakajian 8392acdf3f delete files based on S3, with a date to be backwards compatible 2017-04-05 23:23:38 -04:00
Cassie Tarakajian f01a58353b initial commit to cloning files on S3, untested 2017-04-05 23:23:37 -04:00
Andrew Nicolaou dc801ccf7f Force HTTPS redirection for log in and sign up (#319)
* Higher-order component to force some routes to HTTPS

* Force all user-management routes to HTTPS

* Redirect to sourceProtocol as route unmounts.

By default, no redirection occurs if sourceProtocol is not explicitly
defined.

* Sets serveSecure flag on new projects and usea after forcing protocol

The flag is set to `false` on all projects and as the UI has no way to
change this, it always redirects to HTTP after a signup/login action.

* Move HoC to be with other top-level components

* Server should respond to account page request

* Serves AccountView over HTTPS

* Turns HTTPS redirection off in development by default

Will log to the browser console any redirection that would
have happened. Added a line in the README about how to
enable this for testing in development.
2017-03-30 12:36:26 -04:00
Yining Shi fe6acc90e4 Adding User Settings View (#325)
* added account page showing username and email

* change username and email

* validate current password and add new  password

* reject promise with error for reduxForm submit-validation for current password

* updated user reducer to handle setting sucess and server side async

* warning if there is current password but no new password

* fixes logout button

* import validate function, fixes logout style
2017-03-16 18:25:12 -04:00
Cassie Tarakajian e87390adb9 update eslint to latest version, fix lots of linting errors (#308)
* update eslint and dependencies, fix linting errors that can be fixed with --fix

* fix lots of linting errors

* update eslintrc, fix some linting errors

* fix all server side linting errors, untested

* fix errors that fixing linting errors had caused

* fix client side eslint errors

* fix client side linting errors

* fix refs lint errors

* fix more linting errors

* update eslint and dependencies, fix linting errors that can be fixed with --fix

* fix lots of linting errors

* update eslintrc, fix some linting errors

* fix all server side linting errors, untested

* fix errors that fixing linting errors had caused

* fix client side eslint errors

* fix client side linting errors

* fix refs lint errors

* fix more linting errors

* fix some accessibility linting errors

* fix a lot of linting errors

* fix a billion more linting errors

* hopefully fix all linting errors, still need to test

* fix bugs that fixing linting had caused
2017-02-22 14:29:35 -05:00
Cassie Tarakajian 311e8442a1 Revert "Email verification" (#265) 2017-01-13 10:35:39 -05:00
Akarshit Wal 2d781e22fb Email verification (#230)
* Making the email separate for future enhancements

* email-verification added

* Github users are verified

* update package

* Bug fixes and improvements

* jade to pug

* Bug fix

* changed route
2017-01-13 10:24:09 -05:00
Cassie Tarakajian fc8318c297 fix some linting errors 2017-01-11 15:50:36 -05:00
Cassie Tarakajian b02b8f99fe fix 404 page typo 2017-01-06 15:05:02 -05:00
Enrique Piqueras 5e4b076b93 Fixed #158 and #100 (#198)
* Changed unsaved changes asterisk to an svg circle. #158

* Fixed #100
Unmatched routes are handled by react-router on the client side
and a single wildcard route on server.routes.js renders the index
html.
When the /:username/sketches route is matched and the username is not
valid, the user will be redirected to the index route and a toast
will explain what happened. When the username is 'p5' (default when
logged out) it will show all sketches. Maybe this should be changed
to just public or 'local' sketches?

* Moved unsaved changes SVG to a separate file.

* User not found is now a 404 error.

* Added server rendered 404 page.

* Removed console.log

* 404 Page now renders a random p5 sketch. TODO: make 404 sketches.

* Added 404 header
404 page now fetches a random example sketch

* Moved circle closer to file name

* Render 404 page in SketchList route if !user
2017-01-06 13:08:03 -05:00
Jen Kagan 55b54f09bd Change routes to /:username/sketches/:projectid (#216) 2016-12-01 17:12:34 -05:00
Cassie Tarakajian af3cb60ce1 fix linting errors that are fixable with --fix in server side code 2016-11-17 11:15:35 -05:00
Cassie Tarakajian f40ecebfba #142 add webpack configuration to decrease loading speed 2016-11-08 18:11:12 -05:00
Cassie Tarakajian 2750b1f0ef #189 i have literally been putting this off for months but i finally figured out now to resolve file paths \ 😄 / 2016-11-08 16:50:21 -05:00
Cassie Tarakajian 081c7d521e #189 load text files from server via filename, does not work for file paths 2016-11-08 14:42:23 -05:00
Cassie Tarakajian 85b8f5b589 fixes #96, downloads now work on safari and firefox 2016-11-02 14:08:53 -04:00
Cassie Tarakajian 2645e13786 change full screen view to embed view 2016-11-02 11:12:07 -04:00
Cassie Tarakajian e5ff11f65a add basic password reset functionality, no error checking or styling 2016-10-19 12:36:58 -04:00
Cassie Tarakajian ea6d30c430 more password reset stuff 2016-10-19 12:36:57 -04:00
Cassie Tarakajian 1610b0168d start to add mailgun and nodemailer 2016-10-19 12:36:57 -04:00
kaganjd 76bd1b1630 Add ability to delete projects from sketch list (#125)
* Add ability to delete projects from sketch list

- Fixes #76
- Also gets rid of outdated Sketch module

* Styling for Sketch List trash can

* Merge all the stuff

* Fix trash can line height
2016-10-12 14:24:53 -04:00
catarak 207bab20eb add embed route, fix path parsing in PreviewFrame 2016-09-06 16:54:16 -04:00
catarak 3dfed2a11e delete files works, server side 2016-09-02 17:41:01 -04:00
catarak 3b6bfbc552 check for duplicate email and username 2016-09-02 14:51:30 -04:00
catarak 64b2ea3da4 add and test logout 2016-08-27 20:46:20 -04:00
catarak 8713e297dd add about modal to link to github 2016-08-22 12:35:59 -04:00