KEYCLOAK-113: Added page for SMTP server configuration.

This commit is contained in:
ammendonca 2013-11-05 00:28:21 +00:00
parent 97792b7e1d
commit 859659f25e
9 changed files with 332 additions and 149 deletions

View file

@ -6,7 +6,6 @@ var resourceRequests = 0;
module.config([ '$routeProvider', function($routeProvider) { module.config([ '$routeProvider', function($routeProvider) {
$routeProvider $routeProvider
.when('/create/realm', { .when('/create/realm', {
templateUrl : 'partials/realm-detail.html', templateUrl : 'partials/realm-detail.html',
resolve : { resolve : {
@ -15,7 +14,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'RealmDetailCtrl' controller : 'RealmDetailCtrl'
}).when('/realms/:realm', { })
.when('/realms/:realm', {
templateUrl : 'partials/realm-detail.html', templateUrl : 'partials/realm-detail.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -23,10 +23,12 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'RealmDetailCtrl' controller : 'RealmDetailCtrl'
}).when('/realms', { })
.when('/realms', {
templateUrl : 'partials/realm-list.html', templateUrl : 'partials/realm-list.html',
controller : 'RealmListCtrl' controller : 'RealmListCtrl'
}).when('/realms/:realm/token-settings', { })
.when('/realms/:realm/token-settings', {
templateUrl : 'partials/realm-tokens.html', templateUrl : 'partials/realm-tokens.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -34,7 +36,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'RealmTokenDetailCtrl' controller : 'RealmTokenDetailCtrl'
}).when('/realms/:realm/social-settings', { })
.when('/realms/:realm/social-settings', {
templateUrl : 'partials/realm-social.html', templateUrl : 'partials/realm-social.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -52,6 +55,15 @@ module.config([ '$routeProvider', function($routeProvider) {
}, },
controller : 'RealmRequiredCredentialsCtrl' controller : 'RealmRequiredCredentialsCtrl'
}) })
.when('/realms/:realm/smtp-settings', {
templateUrl : 'partials/realm-smtp.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmSMTPSettingsCtrl'
})
.when('/create/user/:realm', { .when('/create/user/:realm', {
templateUrl : 'partials/user-detail.html', templateUrl : 'partials/user-detail.html',
resolve : { resolve : {
@ -63,7 +75,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'UserDetailCtrl' controller : 'UserDetailCtrl'
}).when('/realms/:realm/users/:user', { })
.when('/realms/:realm/users/:user', {
templateUrl : 'partials/user-detail.html', templateUrl : 'partials/user-detail.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -74,7 +87,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'UserDetailCtrl' controller : 'UserDetailCtrl'
}).when('/realms/:realm/users/:user/role-mappings', { })
.when('/realms/:realm/users/:user/role-mappings', {
templateUrl : 'partials/role-mappings.html', templateUrl : 'partials/role-mappings.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -91,7 +105,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'UserRoleMappingCtrl' controller : 'UserRoleMappingCtrl'
}).when('/realms/:realm/users', { })
.when('/realms/:realm/users', {
templateUrl : 'partials/user-list.html', templateUrl : 'partials/user-list.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -112,7 +127,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'RoleDetailCtrl' controller : 'RoleDetailCtrl'
}).when('/realms/:realm/roles/:role', { })
.when('/realms/:realm/roles/:role', {
templateUrl : 'partials/role-detail.html', templateUrl : 'partials/role-detail.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -123,7 +139,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'RoleDetailCtrl' controller : 'RoleDetailCtrl'
}).when('/realms/:realm/roles', { })
.when('/realms/:realm/roles', {
templateUrl : 'partials/role-list.html', templateUrl : 'partials/role-list.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -150,7 +167,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'ApplicationRoleDetailCtrl' controller : 'ApplicationRoleDetailCtrl'
}).when('/realms/:realm/applications/:application/roles/:role', { })
.when('/realms/:realm/applications/:application/roles/:role', {
templateUrl : 'partials/application-role-detail.html', templateUrl : 'partials/application-role-detail.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -164,7 +182,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'ApplicationRoleDetailCtrl' controller : 'ApplicationRoleDetailCtrl'
}).when('/realms/:realm/applications/:application/credentials', { })
.when('/realms/:realm/applications/:application/credentials', {
templateUrl : 'partials/application-credentials.html', templateUrl : 'partials/application-credentials.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -175,7 +194,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'ApplicationCredentialsCtrl' controller : 'ApplicationCredentialsCtrl'
}).when('/realms/:realm/applications/:application/roles', { })
.when('/realms/:realm/applications/:application/roles', {
templateUrl : 'partials/application-role-list.html', templateUrl : 'partials/application-role-list.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -189,7 +209,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'ApplicationRoleListCtrl' controller : 'ApplicationRoleListCtrl'
}).when('/realms/:realm/applications/:application/scope-mappings', { })
.when('/realms/:realm/applications/:application/scope-mappings', {
templateUrl : 'partials/application-scope-mappings.html', templateUrl : 'partials/application-scope-mappings.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -208,8 +229,6 @@ module.config([ '$routeProvider', function($routeProvider) {
controller : 'ApplicationScopeMappingCtrl' controller : 'ApplicationScopeMappingCtrl'
}) })
.when('/create/application/:realm', { .when('/create/application/:realm', {
templateUrl : 'partials/application-detail.html', templateUrl : 'partials/application-detail.html',
resolve : { resolve : {
@ -224,7 +243,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'ApplicationDetailCtrl' controller : 'ApplicationDetailCtrl'
}).when('/realms/:realm/applications/:application', { })
.when('/realms/:realm/applications/:application', {
templateUrl : 'partials/application-detail.html', templateUrl : 'partials/application-detail.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
@ -238,7 +258,8 @@ module.config([ '$routeProvider', function($routeProvider) {
} }
}, },
controller : 'ApplicationDetailCtrl' controller : 'ApplicationDetailCtrl'
}).when('/realms/:realm/applications', { })
.when('/realms/:realm/applications', {
templateUrl : 'partials/application-list.html', templateUrl : 'partials/application-list.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {

View file

@ -453,3 +453,38 @@ module.controller('RoleDetailCtrl', function($scope, realm, role, Role, $locatio
}); });
}; };
}); });
module.controller('RealmSMTPSettingsCtrl', function($scope, Current, Realm, realm, $http, $location, Dialog, Notifications) {
$scope.realm = {
id : realm.id, realm : realm.realm, social : realm.social,
smtpServer: realm.smtpServer
};
var oldCopy = angular.copy($scope.realm);
$scope.changed = false;
$scope.$watch('realm', function() {
if (!angular.equals($scope.realm, oldCopy)) {
$scope.changed = true;
}
}, true);
$scope.save = function() {
if ($scope.realmForm.$valid) {
var realmCopy = angular.copy($scope.realm);
$scope.changed = false;
Realm.update(realmCopy, function () {
$location.url("/realms/" + realm.id + "/smtp-settings");
Notifications.success("Your changes have been saved to the realm.");
});
} else {
$scope.realmForm.showErrors = true;
}
};
$scope.reset = function() {
$scope.realm = angular.copy(oldCopy);
$scope.changed = false;
$scope.realmForm.showErrors = false;
};
});

View file

@ -9,6 +9,7 @@
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li> <li class="active"><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li> <li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">

View file

@ -9,6 +9,7 @@
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li> <li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li> <li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">

View file

@ -0,0 +1,121 @@
<div id="wrapper" class="container">
<div class="row">
<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm">
<ul class="rcue-tabs">
<li><a href="#/realms/{{realm.id}}">General</a></li>
<li data-ng-show="realm.social"><a href="#/realms/{{realm.id}}/social-settings">Social</a></li>
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul>
</div>
<div id="content">
<ol class="breadcrumb">
<li><a href="#/realms/{{realm.id}}">{{realm.realm}}</a></li>
<li><a href="#/realms/{{realm.id}}">Settings</a></li>
<li class="active">SMTP Configuration</li>
</ol>
<h2><span>{{realm.realm}}</span> SMTP Settings</h2>
<form name="realmForm" novalidate>
<fieldset>
<legend uncollapsed><span class="text">Required Settings</span></legend>
<div class="form-group clearfix">
<label for="smtpHost" class="control-label">Host <span class="required">*</span></label>
<div class="controls">
<input id="smtpHost" type="text" ng-model="realm.smtpServer.host" placeholder="SMTP Host" required>
</div>
</div>
<div class="form-group clearfix">
<label for="smtpPort" class="control-label">Port <span class="required">*</span></label>
<div class="controls">
<input id="smtpPort" type="text" ng-model="realm.smtpServer.port" placeholder="SMTP Port (defaults to 25)" required>
</div>
</div>
<div class="form-group clearfix">
<label for="smtpFrom" class="control-label">From <span class="required">*</span></label>
<div class="controls">
<input id="smtpFrom" type="email" ng-model="realm.smtpServer.from" placeholder="SMTP From" required>
</div>
</div>
<div class="form-group clearfix">
<label for="smtpSSL" class="control-label">Enable SSL</label>
<div class="onoffswitch">
<input type="checkbox" data-ng-model="realm.smtpServer.ssl.enable" class="onoffswitch-checkbox" name="smtpSSL" id="smtpSSL">
<label for="smtpSSL" class="onoffswitch-label">
<span class="onoffswitch-inner">
<span class="onoffswitch-active">ON</span>
<span class="onoffswitch-inactive">OFF</span>
</span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</fieldset>
<fieldset>
<legend collapsed><span class="text">Authentication</span></legend>
<div class="form-group clearfix">
<label for="smtpAuth" class="control-label">Enabled</label>
<div class="onoffswitch">
<input type="checkbox" data-ng-model="realm.smtpServer.auth" class="onoffswitch-checkbox" name="smtpAuth" id="smtpAuth">
<label for="smtpAuth" class="onoffswitch-label">
<span class="onoffswitch-inner">
<span class="onoffswitch-active">ON</span>
<span class="onoffswitch-inactive">OFF</span>
</span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
<div class="form-group clearfix">
<label for="smtpUsername" class="control-label">Username <span class="required" ng-show="realm.smtpServer.auth">*</span></label>
<div class="controls">
<input id="smtpUsername" type="text" ng-model="realm.smtpServer.user" placeholder="Login Username" ng-disabled="!realm.smtpServer.auth" ng-required="realm.smtpServer.auth">
</div>
</div>
<div class="form-group clearfix">
<label for="smtpPassword" class="control-label">Password <span class="required" ng-show="realm.smtpServer.auth">*</span></label>
<div class="controls">
<input id="smtpPassword" type="password" ng-model="realm.smtpServer.password" placeholder="Login Password" ng-disabled="!realm.smtpServer.auth" ng-required="realm.smtpServer.auth">
</div>
</div>
</fieldset>
<!--
<fieldset class="border-top">
<div class="form-group clearfix" ng-repeat="(name, setting) in smtpSettings | orderBy: setting.required">
<label for="{{name}}" class="control-label">{{name.replace('mail.smtp.','')}} <span class="required" data-ng-show="setting.required">*</span></label>
<div ng-show="setting.type == 'boolean'" class="onoffswitch">
<input type="checkbox" data-ng-model="realm.smtp[name]" class="onoffswitch-checkbox" name="{{name}}" id="{{name}}">
<label for="{{name}}" class="onoffswitch-label">
<span class="onoffswitch-inner">
<span class="onoffswitch-active">ON</span>
<span class="onoffswitch-inactive">OFF</span>
</span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<div ng-show="setting.type == 'String'" class="controls">
<input id="{{name}}" type="text" ng-model="realm.smtp[name]" placeholder="SMTP {{name}} / {{ setting.required }}">
</div>
<div ng-show="setting.type == 'int'" class="controls">
<input id="{{name}}" type="number" ng-model="realm.smtp[name]" placeholder="SMTP {{name}} / {{ setting.required }}">
</div>
</div>
</fieldset>
-->
<div class="form-actions">
<button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
</button>
<button type="submit" data-ng-click="reset()" data-ng-show="changed">Clear changes
</button>
</div>
</form>
</div>
</div>
<div id="container-right-bg"></div>
</div>
</div>

View file

@ -9,6 +9,7 @@
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li> <li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li> <li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">

View file

@ -9,6 +9,7 @@
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li> <li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li> <li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/token-settings">Token</a></li> <li class="active"><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">

View file

@ -9,6 +9,7 @@
<li class="active"><a href="#/realms/{{realm.id}}/roles">Roles</a></li> <li class="active"><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li> <li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li> <li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">

View file

@ -9,6 +9,7 @@
<li class="active"><a href="#/realms/{{realm.id}}/roles">Roles</a></li> <li class="active"><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li> <li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li> <li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">