mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Client: i18n (#8972)
* wip: client: i18n * remove maxAge from cookies to get same expiration ad localStorage * set cookies expiration to 10 years * moment: load translations in browser, moment: only load necessary data, remove jquery, remove bluebird * ability to change language * fix logout * add some requiresLogin: false to static pages * fix tests
This commit is contained in:
@@ -25,14 +25,16 @@ module.exports.readController = function readController (router, controller) {
|
||||
|
||||
let middlewaresToAdd = [getUserLanguage];
|
||||
|
||||
if (authMiddlewareIndex !== -1) { // the user will be authenticated, getUserLanguage and cron after authentication
|
||||
if (authMiddlewareIndex === middlewares.length - 1) {
|
||||
middlewares.push(...middlewaresToAdd);
|
||||
} else {
|
||||
middlewares.splice(authMiddlewareIndex + 1, 0, ...middlewaresToAdd);
|
||||
if (action.noLanguage !== true) {
|
||||
if (authMiddlewareIndex !== -1) { // the user will be authenticated, getUserLanguage after authentication
|
||||
if (authMiddlewareIndex === middlewares.length - 1) {
|
||||
middlewares.push(...middlewaresToAdd);
|
||||
} else {
|
||||
middlewares.splice(authMiddlewareIndex + 1, 0, ...middlewaresToAdd);
|
||||
}
|
||||
} else { // no auth, getUserLanguage as the first middleware
|
||||
middlewares.unshift(...middlewaresToAdd);
|
||||
}
|
||||
} else { // no auth, getUserLanguage as the first middleware
|
||||
middlewares.unshift(...middlewaresToAdd);
|
||||
}
|
||||
|
||||
method = method.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user