mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Add user form & action
This commit is contained in:
parent
0f9d9b8de5
commit
6d2755e236
3 changed files with 29 additions and 0 deletions
|
@ -40,3 +40,7 @@ html, body {
|
|||
font-weight: bold;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
body .form-control {
|
||||
padding: 6px;
|
||||
}
|
||||
|
|
21
js/app.js
21
js/app.js
|
@ -180,6 +180,26 @@ app = Sammy('#main', function (sam) {
|
|||
});
|
||||
});
|
||||
|
||||
sam.get('#/users/create', function (c) {
|
||||
c.api('/domains', function(data) {
|
||||
c.view('user_create', data);
|
||||
});
|
||||
});
|
||||
|
||||
sam.post('#/users', function (c) {
|
||||
if (c.params['password'] == c.params['confirmation']) {
|
||||
c.params['mail'] = c.params['email'] + '@' + c.params['domain'];
|
||||
c.api('/users', function(data) {
|
||||
c.flash('success', 'User successfully created');
|
||||
c.redirect('#/users');
|
||||
}, 'POST', c.params.toHash());
|
||||
} else {
|
||||
c.flash('fail', "Passwords don't match");
|
||||
store.clear('slide');
|
||||
//c.redirect('#/users/create');
|
||||
}
|
||||
});
|
||||
|
||||
sam.get('#/users/:user', function (c) {
|
||||
c.api('/users/'+ c.params['user'], function(data) {
|
||||
c.view('user_info', data);
|
||||
|
@ -208,6 +228,7 @@ app = Sammy('#main', function (sam) {
|
|||
}, 'PUT', params);
|
||||
}
|
||||
});
|
||||
|
||||
sam.get('#/users/:user/delete', function (c) {
|
||||
if (confirm('Are you sure you want to delete '+ c.params['user'] +' ?')) {
|
||||
c.api('/users/'+ c.params['user'], function(data) {
|
||||
|
|
|
@ -13,3 +13,7 @@
|
|||
{{/Users}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<a href="#/users/create" class="btn btn-lg btn-success slide"><span class="glyphicon glyphicon-plus"></span> New user</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue