03ea72595d
* Initial Commit for OAuth API This builds and run and return the right error. Need to test it and then adding all users as possible client * Added mising dependency * just compile already... * Fixing template test * Imrpovements Moved db stuff in models Added some tests Added form in modpanel to add/update a client Added controllers for add/update of client * Added Forms + speed improvements Controller oauth client listing + html Controller oauth client delete + messages Messages on comment delete New ES config that disable ES if set to false. Improve load speed on local development Fix a load config bug Fix index admin & translation string sign_out broken by @ewhal * Sanitize empty strig in form array + css Multiple empty array of strings are sanitized for the oauth client create form Added some css for the form display * Upload and Create form works * Fix splitting response types * Removing required on secret when updating * fix travis error * Fix travis template test * Update dependency * Moved to jinzhu instead of azhao * randomizen secret on creation * Final touch on oath api improved display name fix grant form csrf fix login csrf on oauth * Fix gorm test * fix template test * Fixing deleted dependency issue * Make travis faster * Fix typo * Fix csrf for api calls * This shouldn't be exempt * Removing hard coded hash @ewhal Don't forget to replace the hash in tokens.go with another one * Added an example on how to use OAuth middleware * Renamed fosite utils to oauth2 utils
154 lignes
Pas d'EOL
7,5 Kio
HTML
154 lignes
Pas d'EOL
7,5 Kio
HTML
{{ extends "layouts/index_admin" }}
|
|
{{ import "layouts/partials/helpers/errors" }}
|
|
{{block title()}}{{ if Form.ID != "" }}{{ T("update_client_panel") }}{{ else }}{{ T("create_client_panel") }}{{ end }}{{end}}
|
|
{{ block content_body()}}
|
|
<div class="results box">
|
|
<h3 id="clients">{{ if Form.ID != "" }}{{ T("update_client_panel") }}{{ else }}{{ T("create_client_panel") }}{{ end }}</h3>
|
|
<form style="text-align:left;padding-left:10px;padding-right:10px;" method="POST" action="{{ if Form.ID != ""}}?id={{ Form.ID }}{{end}}">
|
|
<div class="form-group">
|
|
<label for="name">{{ T("name")}}</label>
|
|
<input type="text" name="name" id="name" class="form-input up-input" placeholder="{{ T("name")}}" value="{{Form.Name}}" required>
|
|
{{ yield errors(name="Name")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="owner">{{ T("owner")}}</label>
|
|
<input type="text" name="owner" id="owner" class="form-input up-input" placeholder="{{ T("owner")}}" value="{{Form.Owner}}" required>
|
|
{{ yield errors(name="Owner")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="secret">{{ T("secret")}}</label>
|
|
<input type="text" name="secret" id="secret" class="form-input up-input" placeholder="{{ T("secret")}}" value="{{Form.Secret}}"{{ if Form.ID == "" }} required{{end}}>
|
|
{{ yield errors(name="Secret")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="contacts">{{ T("contacts")}}</label>
|
|
<div class="input-ui-list">
|
|
{{ range Form.Contacts }}
|
|
<div class="element">
|
|
<input type="text" name="contacts" id="contacts" class="form-input up-input" placeholder="{{ T("contacts")}}" value="{{.}}">
|
|
<button class="remove-input form-input btn-red">{{ T("remove") }}</button>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<button class="add-input form-input btn-green">{{ T("add") }}</button>
|
|
{{ yield errors(name="Contacts")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="redirect_uri">{{ T("redirect_uri")}}</label>
|
|
<div class="input-ui-list">
|
|
{{ range Form.RedirectURI }}
|
|
<div class="element">
|
|
<input type="text" name="redirect_uri" id="redirect_uri" class="form-input up-input" placeholder="{{ T("redirect_uri")}}" value="{{.}}">
|
|
<button class="remove-input form-input btn-red">{{ T("remove") }}</button>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<button class="add-input form-input btn-green">{{ T("add") }}</button>
|
|
{{ yield errors(name="RedirectURI")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="grant_types">{{ T("grant_types")}}</label>
|
|
<div class="input-ui-list">
|
|
{{ range Form.GrantTypes }}
|
|
<div class="element">
|
|
<input type="text" name="grant_types" id="grant_types" class="form-input up-input" placeholder="{{ T("grant_types")}}" value="{{.}}">
|
|
<button class="remove-input form-input btn-red">{{ T("remove") }}</button>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<button class="add-input form-input btn-green">{{ T("add") }}</button>
|
|
{{ yield errors(name="GrantTypes")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="response_types">{{ T("response_types")}}</label>
|
|
<div class="input-ui-list">
|
|
{{ range Form.ResponseTypes }}
|
|
<div class="element">
|
|
<input type="text" name="response_types" id="response_types" class="form-input up-input" placeholder="{{ T("response_types")}}" value="{{.}}">
|
|
<button class="remove-input form-input btn-red">{{ T("remove") }}</button>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<button class="add-input form-input btn-green">{{ T("add") }}</button>
|
|
{{ yield errors(name="ResponseTypes")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="client_uri">{{ T("website_link")}}</label>
|
|
<input name="client_uri" id="client_uri" class="form-input up-input" type="text" value="{{Form.ClientURI}}">
|
|
{{ yield errors(name="ClientURI")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="scope">{{ T("scope")}}</label>
|
|
<input type="text" name="scope" id="scope" class="form-input up-input" placeholder="{{ T("scope")}}" value="{{Form.Scope}}">
|
|
{{ yield errors(name="Scope")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="policy_uri">{{ T("policy_uri")}}</label>
|
|
<input type="text" name="policy_uri" id="policy_uri" class="form-input up-input" placeholder="{{ T("policy_uri")}}" value="{{Form.PolicyURI}}">
|
|
{{ yield errors(name="PolicyURI")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="tos_uri">{{ T("tos_uri")}}</label>
|
|
<input type="text" name="tos_uri" id="tos_uri" class="form-input up-input" placeholder="{{ T("tos_uri")}}" value="{{Form.TermsOfServiceURI}}">
|
|
{{ yield errors(name="TermsOfServiceURI")}}
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="logo_uri">{{ T("logo_uri")}}</label>
|
|
<input type="text" name="logo_uri" id="logo_uri" class="form-input up-input" placeholder="{{ T("logo_uri")}}" value="{{Form.LogoURI}}">
|
|
{{ yield errors(name="LogoURI")}}
|
|
</div>
|
|
<button type="submit" class="form-input up-input btn-green">{{ T("save_changes")}}</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{ block footer_js()}}
|
|
<script type="text/javascript" src="/js/translation.js"></script>
|
|
<script type="text/javascript">
|
|
T.Add("remove", "{{ T("remove") }}")
|
|
var rminputs = document.querySelectorAll(".remove-input")
|
|
for (var i=0; i<rminputs.length;i++) {
|
|
rminputs[i].addEventListener("click", function(e) {
|
|
removeInput(this)
|
|
e.preventDefault()
|
|
});
|
|
}
|
|
var addinputs = document.querySelectorAll(".add-input")
|
|
for (var i=0; i<addinputs.length;i++) {
|
|
addinputs[i].addEventListener("click", function(e) {
|
|
addInput(this)
|
|
e.preventDefault()
|
|
});
|
|
}
|
|
function addInput(el) {
|
|
var parentDiv = el.parentElement
|
|
var inputs = parentDiv.querySelectorAll("input")
|
|
var divInputList = parentDiv.querySelector(".input-ui-list")
|
|
var divElement = document.createElement("div")
|
|
divElement.className = "element"
|
|
var input = document.createElement("input")
|
|
input.type="text"
|
|
input.name=inputs[0].name
|
|
input.id = inputs[0].id
|
|
input.className = inputs[0].className
|
|
input.placeholder = inputs[0].placeholder
|
|
input.required = inputs[0].required
|
|
divElement.appendChild(input)
|
|
var buttonRemove = document.createElement("button")
|
|
buttonRemove.innerText = T.r("remove")
|
|
buttonRemove.addEventListener("click", function (e) {
|
|
removeInput(this)
|
|
e.preventDefault()
|
|
})
|
|
buttonRemove.className = "form-input remove-input btn-red"
|
|
divElement.appendChild(buttonRemove)
|
|
divInputList.appendChild(divElement)
|
|
}
|
|
function removeInput(el) {
|
|
var parentDiv = el.parentElement
|
|
var inputs = parentDiv.parentElement.querySelectorAll("input")
|
|
if (inputs.length > 1) {
|
|
parentDiv.parentNode.removeChild(parentDiv)
|
|
}
|
|
}
|
|
</script>
|
|
{{end}} |