summaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorWillem van Dreumel <willemvd@users.noreply.github.com>2017-05-01 15:26:53 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-05-01 21:26:53 +0800
commit950f2e207413551b868252a1bced6ce9263d16d4 (patch)
treeb01a330af11c7f8b9e2d1461685d9afb2ae9e485 /public/js
parent2368bbb6727ea5497743c0fdade723b49693cb4c (diff)
downloadgitea-950f2e207413551b868252a1bced6ce9263d16d4.tar.gz
gitea-950f2e207413551b868252a1bced6ce9263d16d4.zip
Additional OAuth2 providers (#1010)
* add google+ * sort signin oauth2 providers based on the name so order is always the same * update auth tip for google+ * add gitlab provider * add bitbucket provider (and some go fmt) * add twitter provider * add facebook provider * add dropbox provider * add openid connect provider incl. new format of tips section in "Add New Source" * lower the amount of disk storage for each session to prevent issues while building cross platform (and disk overflow) * imports according to goimport and code style * make it possible to set custom urls to gitlab and github provider (only these could have a different host) * split up oauth2 into multiple files * small typo in comment * fix indention * fix indentation * fix new line before external import * fix layout of signin part * update "broken" dependency
Diffstat (limited to 'public/js')
-rw-r--r--public/js/index.js62
1 files changed, 59 insertions, 3 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 9b48c24cd3..31b15a76a7 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1047,6 +1047,56 @@ function initAdmin() {
}
}
+ function onOAuth2Change() {
+ $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
+ $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');
+
+ var provider = $('#oauth2_provider').val();
+ switch (provider) {
+ case 'github':
+ case 'gitlab':
+ $('.oauth2_use_custom_url').show();
+ break;
+ case 'openidConnect':
+ $('.open_id_connect_auto_discovery_url input').attr('required', 'required');
+ $('.open_id_connect_auto_discovery_url').show();
+ break;
+ }
+ onOAuth2UseCustomURLChange();
+ }
+
+ function onOAuth2UseCustomURLChange() {
+ var provider = $('#oauth2_provider').val();
+ $('.oauth2_use_custom_url_field').hide();
+ $('.oauth2_use_custom_url_field input[required]').removeAttr('required');
+
+ if ($('#oauth2_use_custom_url').is(':checked')) {
+ if (!$('#oauth2_token_url').val()) {
+ $('#oauth2_token_url').val($('#' + provider + '_token_url').val());
+ }
+ if (!$('#oauth2_auth_url').val()) {
+ $('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());
+ }
+ if (!$('#oauth2_profile_url').val()) {
+ $('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());
+ }
+ if (!$('#oauth2_email_url').val()) {
+ $('#oauth2_email_url').val($('#' + provider + '_email_url').val());
+ }
+ switch (provider) {
+ case 'github':
+ $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');
+ $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();
+ break;
+ case 'gitlab':
+ $('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');
+ $('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();
+ $('#oauth2_email_url').val('');
+ break;
+ }
+ }
+ }
+
// New authentication
if ($('.admin.new.authentication').length > 0) {
$('#auth_type').change(function () {
@@ -1075,22 +1125,28 @@ function initAdmin() {
break;
case '6': // OAuth2
$('.oauth2').show();
- $('.oauth2 input').attr('required', 'required');
+ $('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
+ onOAuth2Change();
break;
}
-
if (authType == '2' || authType == '5') {
onSecurityProtocolChange()
}
});
$('#auth_type').change();
- $('#security_protocol').change(onSecurityProtocolChange)
+ $('#security_protocol').change(onSecurityProtocolChange);
+ $('#oauth2_provider').change(onOAuth2Change);
+ $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
}
// Edit authentication
if ($('.admin.edit.authentication').length > 0) {
var authType = $('#auth_type').val();
if (authType == '2' || authType == '5') {
$('#security_protocol').change(onSecurityProtocolChange);
+ } else if (authType == '6') {
+ $('#oauth2_provider').change(onOAuth2Change);
+ $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
+ onOAuth2Change();
}
}
c { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
[[sqlcontainer]]
== Vaadin SQLContainer

Vaadin SQLContainer is a container implementation that allows easy and
customizable access to data stored in various SQL-speaking databases.

SQLContainer supports two types of database access. Using
[classname]#TableQuery#, the pre-made query generators will enable fetching,
updating, and inserting data directly from the container into a database table -
automatically, whereas [classname]#FreeformQuery# allows the developer to use
their own, probably more complex query for fetching data and their own optional
implementations for writing, filtering and sorting support - item and property
handling as well as lazy loading will still be handled automatically.

In addition to the customizable database connection options, SQLContainer also
extends the Vaadin [classname]#Container# interface to implement more advanced
and more database-oriented filtering rules. Finally, the add-on also offers
connection pool implementations for JDBC connection pooling and JEE connection
pooling, as well as integrated transaction support; auto-commit mode is also
provided.

The purpose of this section is to briefly explain the architecture and some of
the inner workings of SQLContainer. It will also give the readers some examples
on how to use SQLContainer in their own applications. The requirements,
limitations and further development ideas are also discussed.

SQLContainer is available from the Vaadin Directory under the same unrestrictive
Apache License 2.0 as the Vaadin Framework itself.


include::sqlcontainer-architecture.asciidoc[leveloffset=+2]

include::sqlcontainer-getting-started.asciidoc[leveloffset=+2]

include::sqlcontainer-filteringsorting.asciidoc[leveloffset=+2]

include::sqlcontainer-editing.asciidoc[leveloffset=+2]

include::sqlcontainer-caching.asciidoc[leveloffset=+2]

include::sqlcontainer-referencing.asciidoc[leveloffset=+2]

include::sqlcontainer-freeform.asciidoc[leveloffset=+2]

include::sqlcontainer-nonimplemented.asciidoc[leveloffset=+2]

include::sqlcontainer-limitations.asciidoc[leveloffset=+2]