Skip to content
Snippets Groups Projects
Commit a3b8bd19 authored by Arie Peterson's avatar Arie Peterson
Browse files

Disable changing email address in kratos settings

parent 000ccfcc
No related branches found
No related tags found
No related merge requests found
......@@ -356,19 +356,29 @@ function getFormElement(node, context) {
}
if (name == 'email' || name == 'traits.email') {
var label;
var disable;
if (context == 'settings') {
disable = true;
label = 'Changing your e-mail address is not supported at this point.';
} else {
disable = false;
label = 'Please provide your e-mail address. We will send a recovery link to that e-mail address.';
}
return getFormInput(
'email',
name,
value,
'E-mail address',
'Please enter your e-mail address here',
'Please provide your e-mail address. We will send a recovery link to that e-mail address.',
label,
messages,
disable,
);
}
if (name == 'traits.username') {
return getFormInput('name', name, value, 'Username', 'Please provide an username', null, messages);
return getFormInput('name', name, value, 'Username', 'Please provide a username', null, messages);
}
if (name == 'traits.name') {
......@@ -465,10 +475,13 @@ function getFormElement(node, context) {
// param placeHolder: Label to display in field if empty
// param help: Additional help text, displayed below the field in small font
// param messages: Message about failed input
function getFormInput(type, name, value, label, placeHolder, help, messages) {
function getFormInput(type, name, value, label, placeHolder, help, messages, disable) {
if (typeof help == 'undefined' || help == null) {
help = '';
}
if (typeof disable == 'undefined') {
disable = false;
}
console.log('Messages: ', messages);
// Id field for help element
......@@ -496,6 +509,9 @@ function getFormInput(type, name, value, label, placeHolder, help, messages) {
if (placeHolder) {
element += 'placeholder="' + placeHolder + '" ';
}
if (disable) {
element += 'disabled ';
}
element += '>';
if (help) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment