fix: automatic root admin creation if heroku

pull/107/head
NGPixel 8 years ago
parent b32a427abc
commit de23e6c498

@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- **Deploy**: Heroku support
- **History**: History section to list all changes
- **Localization**: All UI text elements are now localized
- **Localization**: Chinese locale is now available (thanks to @choicky)

@ -44,23 +44,19 @@ Wiki.js can run on virtually all platforms where Node.js can (Windows, Mac, Linu
## Milestones
Current and upcoming milestones *(features only, see the [changelog](https://github.com/Requarks/wiki/blob/master/CHANGELOG.md) for list of bug fixes)*:
### Beta 11
- [x] Azure AD authentication
- [x] MathML / Tex math equations
- [x] Support for CJK (Chinese, Japanese & Korean) characters in content, meta and uploads
- [x] All Pages section
Current and upcoming milestones *(major features only, see the [changelog](https://github.com/Requarks/wiki/blob/master/CHANGELOG.md) for complete list of features and bug fixes)*:
### Beta 12
- [ ] Better localization in the UI
- [x] Heroku support
### Beta 13
- [ ] History / Revert to previous version feature
- [ ] Docker support + Auto compile/publish to Docker Hub
- [ ] Heroku support
### Beta 13
### Beta 14
- [ ] Insert Link modal in Editor
- [ ] Better simultaneous user editing handling
@ -83,8 +79,9 @@ We are looking for translators to make Wiki.js available in multiple languages.
**Languages that are already translated:**
- [x] English
- [x] French
- [x] Chinese - *Thanks to [@choicky](https://github.com/choicky)*
- [x] French
- [x] Korean - *Thanks to [@junwonpk](https://github.com/junwonpk)*
- [x] Russian - *Thanks to [@efimlosev](https://github.com/efimlosev)*
- [x] Spanish - *Thanks to [@MatiasArriola](https://github.com/MatiasArriola)*

@ -57,11 +57,11 @@ auth:
local:
enabled: true
google:
enabled: true
enabled: false
clientId: GOOGLE_CLIENT_ID
clientSecret: GOOGLE_CLIENT_SECRET
microsoft:
enabled: true
enabled: false
clientId: MS_APP_ID
clientSecret: MS_APP_SECRET
facebook:

@ -216,7 +216,7 @@ module.exports = function (passport) {
// Create users for first-time
db.onReady.then(() => {
db.User.findOne({ provider: 'local', email: 'guest' }).then((c) => {
return db.User.findOne({ provider: 'local', email: 'guest' }).then((c) => {
if (c < 1) {
// Create guest account
@ -238,8 +238,32 @@ module.exports = function (passport) {
winston.error(err)
})
}
})
}).then(() => {
if (process.env.WIKI_JS_HEROKU) {
return db.User.findOne({ provider: 'local', email: process.env.WIKI_ADMIN_EMAIL }).then((c) => {
if (c < 1) {
// Create root admin account (HEROKU ONLY)
return true
return db.User.create({
provider: 'local',
email: process.env.WIKI_ADMIN_EMAIL,
name: 'Administrator',
password: '$2a$04$MAHRw785Xe/Jd5kcKzr3D.VRZDeomFZu2lius4gGpZZ9cJw7B7Mna', // admin123 (default)
rights: [{
role: 'admin',
path: '/',
exact: false,
deny: false
}]
}).then(() => {
winston.info('[AUTH] Root admin account created successfully!')
}).catch((err) => {
winston.error('[AUTH] An error occured while creating root admin account:')
winston.error(err)
})
} else { return true }
})
} else { return true }
})
})
}

Loading…
Cancel
Save