diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/auth.ts | 40 | ||||
-rw-r--r-- | server/lib/plugins/register-helpers-store.ts | 2 |
2 files changed, 24 insertions, 18 deletions
diff --git a/server/lib/auth.ts b/server/lib/auth.ts index c2a6fcaff..c47ec62d0 100644 --- a/server/lib/auth.ts +++ b/server/lib/auth.ts | |||
@@ -126,26 +126,30 @@ async function proxifyPasswordGrant (req: express.Request, res: express.Response | |||
126 | authOptions.authName, pluginAuth.npmName, loginOptions.id, authOptions.getWeight() | 126 | authOptions.authName, pluginAuth.npmName, loginOptions.id, authOptions.getWeight() |
127 | ) | 127 | ) |
128 | 128 | ||
129 | const loginResult = await authOptions.login(loginOptions) | 129 | try { |
130 | if (loginResult) { | 130 | const loginResult = await authOptions.login(loginOptions) |
131 | logger.info( | 131 | if (loginResult) { |
132 | 'Login success with auth method %s of plugin %s for %s.', | 132 | logger.info( |
133 | authOptions.authName, pluginAuth.npmName, loginOptions.id | 133 | 'Login success with auth method %s of plugin %s for %s.', |
134 | ) | 134 | authOptions.authName, pluginAuth.npmName, loginOptions.id |
135 | 135 | ) | |
136 | res.locals.bypassLogin = { | 136 | |
137 | bypass: true, | 137 | res.locals.bypassLogin = { |
138 | pluginName: pluginAuth.npmName, | 138 | bypass: true, |
139 | authName: authOptions.authName, | 139 | pluginName: pluginAuth.npmName, |
140 | user: { | 140 | authName: authOptions.authName, |
141 | username: loginResult.username, | 141 | user: { |
142 | email: loginResult.email, | 142 | username: loginResult.username, |
143 | role: loginResult.role || UserRole.USER, | 143 | email: loginResult.email, |
144 | displayName: loginResult.displayName || loginResult.username | 144 | role: loginResult.role || UserRole.USER, |
145 | displayName: loginResult.displayName || loginResult.username | ||
146 | } | ||
145 | } | 147 | } |
146 | } | ||
147 | 148 | ||
148 | return | 149 | return |
150 | } | ||
151 | } catch (err) { | ||
152 | logger.error('Error in auth method %s of plugin %s', authOptions.authName, pluginAuth.npmName, { err }) | ||
149 | } | 153 | } |
150 | } | 154 | } |
151 | } | 155 | } |
diff --git a/server/lib/plugins/register-helpers-store.ts b/server/lib/plugins/register-helpers-store.ts index 679ed3650..687974ccf 100644 --- a/server/lib/plugins/register-helpers-store.ts +++ b/server/lib/plugins/register-helpers-store.ts | |||
@@ -198,6 +198,8 @@ export class RegisterHelpersStore { | |||
198 | return { | 198 | return { |
199 | getSetting: (name: string) => PluginModel.getSetting(this.plugin.name, this.plugin.type, name), | 199 | getSetting: (name: string) => PluginModel.getSetting(this.plugin.name, this.plugin.type, name), |
200 | 200 | ||
201 | getSettings: (names: string[]) => PluginModel.getSettings(this.plugin.name, this.plugin.type, names), | ||
202 | |||
201 | setSetting: (name: string, value: string) => PluginModel.setSetting(this.plugin.name, this.plugin.type, name, value) | 203 | setSetting: (name: string, value: string) => PluginModel.setSetting(this.plugin.name, this.plugin.type, name, value) |
202 | } | 204 | } |
203 | } | 205 | } |