Compare commits
No commits in common. "f9a95317a2c250277a10aa00219a8d0190a7a5fe" and "2e29b8b04616dd2bfdf9f13ca2af257d4a9d0906" have entirely different histories.
f9a95317a2
...
2e29b8b046
3 changed files with 10 additions and 22 deletions
|
@ -55,12 +55,6 @@ def create_issue_thread(sender, instance, created, **kwargs):
|
||||||
if created:
|
if created:
|
||||||
StateChange.objects.create(issue_thread=instance, state='pending_new')
|
StateChange.objects.create(issue_thread=instance, state='pending_new')
|
||||||
|
|
||||||
class Meta:
|
|
||||||
permissions = [
|
|
||||||
('send_mail', 'Can send mail'),
|
|
||||||
('add_issuethread_manual', 'Can add issue thread manually'),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class Comment(models.Model):
|
class Comment(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
|
|
|
@ -68,10 +68,6 @@ const routes = [
|
||||||
path: 'users/', name: 'users', component: AccessControl, meta:
|
path: 'users/', name: 'users', component: AccessControl, meta:
|
||||||
{requiresAuth: true, requiresPermission: 'delete_event'}
|
{requiresAuth: true, requiresPermission: 'delete_event'}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'boxes/', name: 'admin_boxes', component: BoxesAdmin, meta:
|
|
||||||
{requiresAuth: true, requiresPermission: 'delete_event'}
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{path: '/user', name: 'user', component: Empty, meta: {requiresAuth: true}},
|
{path: '/user', name: 'user', component: Empty, meta: {requiresAuth: true}},
|
||||||
|
|
|
@ -110,14 +110,12 @@ const store = new Vuex.Store({
|
||||||
},
|
},
|
||||||
isLoggedIn(state) {
|
isLoggedIn(state) {
|
||||||
if (!state.local_loaded) {
|
if (!state.local_loaded) {
|
||||||
state.remember = localStorage.getItem('remember') === 'true';
|
state.remember = localStorage.getItem('remember') === 'true'
|
||||||
state.user = localStorage.getItem('user');
|
state.user = localStorage.getItem('user')
|
||||||
//state.password = localStorage.getItem('password');
|
state.userPermissions = JSON.parse(localStorage.getItem('permissions') || '[]')
|
||||||
state.userPermissions = JSON.parse(localStorage.getItem('permissions') || '[]');
|
state.token = localStorage.getItem('token')
|
||||||
state.token = localStorage.getItem('token');
|
state.token_expiry = localStorage.getItem('token_expiry')
|
||||||
state.token_expiry = localStorage.getItem('token_expiry');
|
state.local_loaded = true
|
||||||
state.local_loaded = true;
|
|
||||||
axios.defaults.headers.common['Authorization'] = `Token ${state.token}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.user !== null && state.token !== null;
|
return state.user !== null && state.token !== null;
|
||||||
|
@ -236,7 +234,7 @@ const store = new Vuex.Store({
|
||||||
body: JSON.stringify({username: username, password: password}),
|
body: JSON.stringify({username: username, password: password}),
|
||||||
credentials: 'omit'
|
credentials: 'omit'
|
||||||
}).then(r => r.json())
|
}).then(r => r.json())
|
||||||
if (data && data.token) {
|
if (data.token) {
|
||||||
commit('setToken', data);
|
commit('setToken', data);
|
||||||
commit('setUser', username);
|
commit('setUser', username);
|
||||||
commit('setPassword', password);
|
commit('setPassword', password);
|
||||||
|
@ -253,14 +251,14 @@ const store = new Vuex.Store({
|
||||||
},
|
},
|
||||||
async reloadToken({commit, state}) {
|
async reloadToken({commit, state}) {
|
||||||
try {
|
try {
|
||||||
if (state.password) {
|
if (data.password) {
|
||||||
const data = await fetch('/api/2/login/', {
|
const data = await fetch('/api/2/login/', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({username: state.user, password: state.password}),
|
body: JSON.stringify({username: state.user, password: state.password}),
|
||||||
credentials: 'omit'
|
credentials: 'omit'
|
||||||
}).then(r => r.json()).catch(e => console.error(e))
|
}).then(r => r.json())
|
||||||
if (data && data.token) {
|
if (data.token) {
|
||||||
commit('setToken', data);
|
commit('setToken', data);
|
||||||
axios.defaults.headers.common['Authorization'] = `Token ${data.token}`;
|
axios.defaults.headers.common['Authorization'] = `Token ${data.token}`;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue