|
|
@@ -8,6 +8,7 @@ import trim from 'trim'; |
|
|
import * as gp from '../avatar/gravatar_provider'; |
|
|
import { dataFns } from '../utils/data_utils'; |
|
|
import { clientConnections, hasFreeSubscription } from './client/index'; |
|
|
import * as captchaField from '../field/captcha'; |
|
|
|
|
|
const { get, init, remove, reset, set, tget, tset, tremove } = dataFns(['core']); |
|
|
|
|
|
@@ -400,6 +401,15 @@ export function defaultADUsernameFromEmailPrefix(m) { |
|
|
return get(m, 'defaultADUsernameFromEmailPrefix', true); |
|
|
} |
|
|
|
|
|
export function setCaptcha(m, value, wasInvalid) { |
|
|
m = captchaField.reset(m, wasInvalid); |
|
|
return set(m, 'captcha', Immutable.fromJS(value)); |
|
|
} |
|
|
|
|
|
export function captcha(m) { |
|
|
return get(m, 'captcha'); |
|
|
} |
|
|
|
|
|
export function prefill(m) { |
|
|
return get(m, 'prefill', {}); |
|
|
} |
|
|
@@ -534,6 +544,12 @@ export function loginErrorMessage(m, error, type) { |
|
|
code = 'password_change_required'; |
|
|
} |
|
|
|
|
|
if (code === 'invalid_captcha') { |
|
|
return captcha(m).get('type') === 'code' |
|
|
? i18n.html(m, 'captchaCodeInputPlaceholder') |
|
|
: i18n.html(m, 'captchaMathInputPlaceholder'); |
|
|
} |
|
|
|
|
|
return ( |
|
|
i18n.html(m, ['error', 'login', code]) || i18n.html(m, ['error', 'login', 'lock.fallback']) |
|
|
); |
|
|
|