This is the code used to host the Daily Bruin's wiki.
This wiki uses a couple of environment variables to allow authentication via Google and secure sessions. For more information, read the wiki.js documentation on authentication and configuration.
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
SESSION_SECRET_KEY=
This wiki also syncs all data to a private repository on GitHub. In order to do this, wiki.js makes use of an SSH key. The public key is in the repository and can be managed on GitHub here.
All DB staffers have @media.ucla.edu
emails. When they log in to the wiki for
the first time with this email, an account is automatically created for them. A
couple of changes in the codebase were required to make this work.
In server/controllers/auth.js
:
//Add `hd` property to get the '@media.ucla.edu' login
router.get(
'/login/google',
passport.authenticate('google', {
scope: ['profile', 'email'],
hd: 'media.ucla.edu',
})
);
In server/models/user.js
:
profile.provider = _.lowerCase(profile.provider);
primaryEmail = _.toLower(primaryEmail);
if (_.split(primaryEmail, '@')[1] !== 'media.ucla.edu') {
return Promise.reject(new Error(lang.t('auth:errors.invaliduseremail')));
}
default rights are also changed to write
:
rights: [
{
role: 'write',
path: '/',
exact: false,
deny: false,
},
],
Note also that the default login background photos have been changed and are in
assets/images
.