templates/authorize.str in rodauth-oauth-0.10.4 vs templates/authorize.str in rodauth-oauth-1.0.0.pre.beta1

- old
+ new

@@ -6,14 +6,18 @@ <img src="#{h(rodauth.oauth_application[rodauth.oauth_applications_logo_uri_column])}" /> HTML end } <p class="lead"> - The application - <a target="_blank" href="#{h(rodauth.oauth_application[rodauth.oauth_applications_homepage_url_column])}"> - #{h(rodauth.oauth_application[rodauth.oauth_applications_name_column])} - </a> would like to access your data. + #{ + rodauth.authorize_page_lead(name: <<-LINK + <a target="_blank" href="#{h(rodauth.oauth_application[rodauth.oauth_applications_homepage_url_column])}"> + #{h(rodauth.oauth_application[rodauth.oauth_applications_name_column])} + </a> + LINK + ) + } </p> <div class="list-group"> #{ if rodauth.oauth_application[rodauth.oauth_applications_tos_uri_column] <<-HTML @@ -50,35 +54,24 @@ data << "</div>" end } <div class="form-group"> - <h1 class="display-6">#{rodauth.oauth_tokens_scopes_label}</h1> + <h1 class="display-6">#{rodauth.oauth_grants_scopes_label}</h1> #{ - rodauth.scopes.map do |scope| - if scope == rodauth.oauth_application_default_scope - <<-HTML - <div class="form-check"> - <input id="#{scope}" class="form-check-input" type="checkbox" name="scope[]" value="#{h(scope)}" checked disabled> - <label class="form-check-label" for="#{scope}">#{h(scope)}</label> - <input type="hidden" name="scope[]" value="#{h(scope)}"> - </div> - HTML - else - <<-HTML - <div class="form-check"> - <input id="#{scope}" class="form-check-input" type="checkbox" name="scope[]" value="#{h(scope)}"> - <label class="form-check-label" for="#{scope}">#{h(scope)}</label> - </div> - HTML - end + rodauth.authorize_scopes.map do |scope| + <<-HTML + <div class="form-check"> + <input id="#{scope}" class="form-check-input" type="checkbox" name="scope[]" value="#{h(scope)}"> + <label class="form-check-label" for="#{scope}">#{h(scope)}</label> + </div> + HTML end.join } <input type="hidden" name="client_id" value="#{rodauth.param("client_id")}"/> - #{"<input type=\"hidden\" name=\"access_type\" value=\"#{rodauth.param("access_type")}\"/>" if rodauth.param_or_nil("access_type")} #{"<input type=\"hidden\" name=\"response_type\" value=\"#{rodauth.param("response_type")}\"/>" if rodauth.param_or_nil("response_type")} #{"<input type=\"hidden\" name=\"response_mode\" value=\"#{rodauth.param("response_mode")}\"/>" if rodauth.param_or_nil("response_mode")} #{"<input type=\"hidden\" name=\"state\" value=\"#{rodauth.param("state")}\"/>" if rodauth.param_or_nil("state")} #{"<input type=\"hidden\" name=\"redirect_uri\" value=\"#{rodauth.redirect_uri}\"/>" if rodauth.param_or_nil("redirect_uri")} @@ -96,8 +89,10 @@ end } </div> <p class="text-center"> <input type="submit" class="btn btn-outline-primary" value="#{h(rodauth.oauth_authorize_button)}"/> - <a href="#{rodauth.redirect_uri}?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request#{ "&state=#{rodauth.param("state")}" if rodauth.param_or_nil("state")}" class="btn btn-outline-danger">#{rodauth.oauth_cancel_button}</a> + <a href="#{rodauth.redirect_uri}?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request#{ "&state=#{rodauth.param("state")}" if rodauth.param_or_nil("state")}" class="btn btn-outline-danger"> + #{rodauth.oauth_cancel_button} + </a> </p> </form>