Commit Graph

25 Commits

Author SHA1 Message Date
Toby Zerner
9bfb797fdc Refactor the web app bootstrapping code
- All custom JS variables are now preloaded into the `app.data` object, rather than directly on the `app` object. This means that admin settings are available in `app.data.settings` rather than `app.settings`, etc.
- Cleaner route handler generation
- Renamed ConfigureClientView to ConfigureWebApp, though the former still exists and is deprecated
- Partial fix for #881 (strips ?nojs=1 from URL if possible, so that refreshing will attempt to load JS version again)
2016-05-26 19:04:24 +09:30
Toby Zerner
e37c7a9b06 Remove sudo mode and add password confirmation when changing email address
closes #674
2016-03-11 12:44:18 +10:30
Toby Zerner
1cfae4ad14 Merge branch 'sudo-mode'
# Conflicts:
#	CHANGELOG.md
2015-12-03 15:12:51 +10:30
Toby Zerner
9896378b59 Overhaul sessions, tokens, and authentication
- Use cookies + CSRF token for API authentication in the default client. This mitigates potential XSS attacks by making the token unavailable to JavaScript. The Authorization header is still supported, but not used by default.
- Make sensitive/destructive actions (editing a user, permanently deleting anything, visiting the admin CP) require the user to re-enter their password if they haven't entered it in the last 30 minutes.
- Refactor and clean up the authentication middleware.
- Add an `onhide` hook to the Modal component. (+1 squashed commit)
2015-12-03 15:11:57 +10:30
Franz Liedke
b3a5822ddb Rename HTTP method override header
This is the name recommended by the JSON-API spec:
http://jsonapi.org/recommendations/#patchless-clients
2015-11-26 17:43:32 +01:00
Toby Zerner
119d1721e0 Revert e1315d2; always attempt to parse JSON
This way if there is a PHP error which outputs a 200 OK text/html response, Flarum will correctly show an error message.
2015-10-31 14:49:14 +10:30
Toby Zerner
e1315d27a4 Only parse as JSON if appropriate content type 2015-10-29 17:52:52 +10:30
Toby Zerner
415b68f84f Add flood control
closes #271
2015-10-22 16:57:48 +10:30
Toby Zerner
c0364cbc9d Clean up some old code 2015-10-22 12:25:22 +10:30
Toby Zerner
ea98e4bda9 More helpful avatar upload error messages
ref #165, #118
2015-10-22 10:40:38 +10:30
Toby Zerner
2a5c0c1c7a Improve request error debug output 2015-10-21 10:47:07 +10:30
Toby Zerner
14af6c0e8b Remove app.trans shortcut
Use `app.translator.trans` instead.
2015-10-21 10:31:28 +10:30
Toby Zerner
b23e821013 Merge branch 'key-adjustment' of https://github.com/dcsjapan/flarum-core into dcsjapan-key-adjustment
# Conflicts:
#	js/forum/src/components/LogInModal.js
2015-10-21 10:02:07 +10:30
Toby Zerner
12830265d9 Change back to 401 error on invalid login
See 26a821e3e2 (commitcomment-13866552)
2015-10-21 09:04:58 +10:30
dcsjapan
49d59089e4 Add third tier to key namespacing
- Changes all `app.trans` calls to `app.translator.trans` calls.
- Changes existing keys to [three-tier namespace structure](https://github.com/flarum/english/pull/12).
- Extracts additional strings for `lib:` namespace.
- Extracts two previously missed strings for EditGroupModal.js.
2015-10-20 13:04:43 +09:00
Toby Zerner
26a821e3e2 Improve client XHR error handling
The default XHR error handler produce an alert which is appropriate to the response status code. It can be overridden per-request (by specifying the `errorHandler` option) so that the alert can be suppressed or displayed in a different position (e.g. inside a modal).

ref #118
2015-10-20 12:48:26 +10:30
Toby Zerner
c08b62af80 Refactor translation and validation
We now use Symfony's Translation component. Yay! We get more powerful pluralisation and better a fallback mechanism. Will want to implement the caching mechanism at some point too. The API is replicated in JavaScript, which could definitely use some testing.

Validators have been refactored so that they are decoupled from models completely (i.e. they simply validate arrays of user input). Language packs should include Laravel's validation messages.

ref #267
2015-10-15 22:30:45 +10:30
Toby Zerner
c7c2d9a755 Fake PATCH/PUT/DELETE requests
closes #502
2015-10-14 12:46:59 +10:30
Toby Zerner
efca923d30 Add "Debug" button to inspect the response of a failed AJAX request
Related to #118
2015-09-18 16:46:46 +09:30
Toby Zerner
df385b7df2 Monkey patch mithril so we can use JSX component syntax
<Alert foo="bar"/> instead of Alert.component({foo: 'bar'})
2015-08-26 16:56:32 +09:30
Toby Zerner
9c7fab5d8c Support running in subdirectory with base_path config 2015-08-13 12:58:59 +09:30
Toby Zerner
26c87de317 Add an API to show a count in the document title 2015-08-04 19:04:17 +09:30
Toby Zerner
5b3484d3c8 Improve error handling somewhat
- Fix composer crashing/not showing alert on error
- Make a general ValidationException which takes an array of field ⇒
messages to be outputted nicely by the API
2015-08-04 13:03:46 +09:30
Toby Zerner
a9ded36b57 Major CSS revamp
- Get rid of Bootstrap (except we still rely on some JS)
- Use BEM class names
- Rework variables/theme config
- Fix various bugs, including some on mobile

The CSS is still not ideal – it needs to be cleaned up some more. But
that can be a focus for after beta.
2015-07-17 14:47:49 +09:30
Toby Zerner
ab6c03c0cc Massive JavaScript cleanup
- Use JSX for templates
- Docblock/comment everything
- Mostly passes ESLint (still some work to do)
- Lots of renaming, refactoring, etc.

CSS hasn't been updated yet.
2015-07-15 14:01:11 +09:30