<style>
    .ui.checkbox {
        margin: 0;
        padding: 0;
    }
    .ui.checkbox {
        position: relative;
        display: inline-block;
        min-height: 17px;
        font-size: 1rem;
        line-height: 15px;
        min-width: 17px;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        outline: none;
        vertical-align: middle;
    }
    .ui.checkbox input {
        position: absolute;
        top: 0px;
        left: 0px;
        opacity: 0 !important;
        outline: none;
        z-index: -1;
    }
    input[type="checkbox"], input[type="radio"] {
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        padding: 0;
    }

    input {
        line-height: normal;
    }
</style>
<% if User.current.logged? %>
  <main role="main">
    <p class="auth-desc">
      <strong class="app-name"><%= @app&.name %></strong>客户端<br/>
      此第三方应用请求获得以下权限:

    </p>
    <div class="choose-checkbox-authorization">
      <ul class="text-info">
        <li>
          <div class="checkbox checked ui">
            <input type="checkbox" name="scopes[]" id="user_info" value="user_info" disabled="disabled" checked="checked">
            <label for="______________">访问你的个人信息、最新动态等</label>
          </div>
        </li>
        <li>
          <div class="checkbox choose-single-checkbox ui checked">
            <input type="checkbox" name="scopes[]" id="emails" value="emails" checked="checked" tabindex="0" class="hidden">
            <label for="__________">查看你的个人邮箱信息</label>
          </div>
        </li>
      </ul>
    </div>

    <div class="actions">
      <div class="w">
        <%= form_tag oauth2_path, method: :post, authenticity_token: true, remote: true, class: 'login-form' do %>
          <%= hidden_field_tag :client_id, @app.uid %>
          <%= hidden_field_tag :call_url, @call_url %>
          <%= submit_tag '同意授权', class: "btn btn-login btn-lg btn-block mt-20" %>
        <% end %>
        <div class="reg">
          <%= link_to "拒绝", '/access_denied', class: 'reg-link' %>
        </div>
      </div>
    </div>
  </main>
<% else %>
  <main role="main">
    <p class="auth-desc">
      申请使用<strong class="app-name"> 红山开源社区 </strong>账号登录
      <strong class="app-name"><%= @app&.name %></strong>
    </p>

    <div class="actions">
      <div class="w">
        <%= form_tag oauth2_path, method: :post, authenticity_token: true, remote: true, class: 'login-form' do %>
          <%= hidden_field_tag :client_id, @app.uid %>
          <%= hidden_field_tag :call_url, @call_url %>
          <p id="account_error" class='error'></p>
          <%= text_field_tag :login, '', placeholder: '请输入邮箱地址/用户名' %>
          <p id="login_error" class='error'></p>
          <%= password_field_tag :password, '', placeholder: '请输入密码' %>
          <p id="password_error" class='error'></p>
          <%= submit_tag '授权登录', class: "btn btn-login btn-lg btn-block mt-20" %>
        <% end %>
        <div class="reg">
          <%= link_to "注 册", '/register', class: 'reg-link' %>
        </div>
      </div>
    </div>
  </main>
<% end %>



