|
|
@@ -183,15 +183,16 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
if (!passportService.isLdapStrategySetup) {
|
|
|
debug('LdapStrategy has not been set up');
|
|
|
- return next();
|
|
|
+ req.flash('warningMessage', 'LdapStrategy has not been set up');
|
|
|
+ return res.redirect('/me/external-accounts');
|
|
|
}
|
|
|
|
|
|
const loginForm = req.body.loginForm;
|
|
|
|
|
|
if (!req.form.isValid) {
|
|
|
- debug("invalid form");
|
|
|
- return res.render('login', {
|
|
|
- });
|
|
|
+ debug('invalid form');
|
|
|
+ req.flash('warningMessage', 'invalid form');
|
|
|
+ return res.redirect('/me/external-accounts');
|
|
|
}
|
|
|
|
|
|
console.log(loginForm);
|
|
|
@@ -205,18 +206,13 @@ module.exports = function(crowi, app) {
|
|
|
console.log('LDAP Server Error: ', err);
|
|
|
req.flash('warningMessage', 'LDAP Server Error occured.');
|
|
|
}
|
|
|
- if (info) {
|
|
|
- if (info.name != null && info.name === 'DuplicatedUsernameException') {
|
|
|
- req.flash('isDuplicatedUsernameExceptionOccured', true);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!user) {
|
|
|
- req.flash('errorMessage', 'Not found.');
|
|
|
+ if (info && info.message) {
|
|
|
+ req.flash('warningMessage', info.message);
|
|
|
}
|
|
|
- else {
|
|
|
+ if (user) {
|
|
|
req.flash('successMessage', 'Successfully added.');
|
|
|
}
|
|
|
- })(req, res, () => { res.redirect('/me/external-accounts'); });
|
|
|
+ })(req, res, () => {res.redirect('/me/external-accounts')});
|
|
|
}
|
|
|
|
|
|
actions.externalAccounts.disassociate = function(req, res) {
|