upd: profile twig
add saveProfile method and required support
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('css/jquery-ui.theme.css') }}" rel='stylesheet' />
|
||||
<link href="{{ asset('css/jquery-ui.structure.css') }}" rel='stylesheet' />
|
||||
<link href="{{ asset('css/style.css') }}" rel='stylesheet' />
|
||||
<link href="{{ asset('styles/style.css') }}" rel='stylesheet' />
|
||||
<link href='//cdn.datatables.net/2.0.8/css/dataTables.dataTables.min.css' rel='stylesheet' />
|
||||
<style>
|
||||
.flex-container {
|
||||
@@ -80,6 +80,49 @@ $(function() {
|
||||
|
||||
});
|
||||
|
||||
function saveProfile() {
|
||||
const name = $('#name');
|
||||
const email = $('#email');
|
||||
const homeChurch = $('#home-church');
|
||||
const password = $('#password');
|
||||
const newPassword = $('#new-password');
|
||||
const confPassword = $('#conf-password');
|
||||
let passChange = false;
|
||||
|
||||
if (newPassword.val().length > 0) {
|
||||
if (password.val().length == 0) {
|
||||
alert('If you want to change your password you need to put in the current password as well');
|
||||
return;
|
||||
}
|
||||
|
||||
if (newPassword.val() != confPassword.val()) {
|
||||
alert('New password and confirm passwords do not match');
|
||||
return;
|
||||
}
|
||||
passChange = true;
|
||||
}
|
||||
|
||||
fetch('/save-profile', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'name': name.val(),
|
||||
'email': email.val(),
|
||||
'homeChurch': homeChurch.val(),
|
||||
'passChange': passChange,
|
||||
'password': password.val(),
|
||||
'newPassword': newPassword.val(),
|
||||
'confPassword': confPassword.val()
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(results => {
|
||||
alert(results.msg);
|
||||
});
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
var saveInterval = $('#save-interval');
|
||||
var saveReferences = $('#save-references');
|
||||
@@ -128,6 +171,9 @@ function rollUp(cont) {
|
||||
<label for='email'>Email: </label>
|
||||
<input type='email' id='email' name='email' value='{{ app.user.email }}' /><br />
|
||||
|
||||
<label for='home-church'>Home Church RSS Feed: </label>
|
||||
<input type='text' id='home-church' name='home-church' value='{{ app.user.homeChurchRSS }}' /><br />
|
||||
|
||||
<label for='password'>Password: </label>
|
||||
<input type='password' id='password' name='password' /><br/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user