fixed oauth2 has login

This commit is contained in:
xxq250 2026-07-31 11:29:11 +08:00
parent 5c991c14be
commit 6e6774ffcb
1 changed files with 97 additions and 22 deletions

View File

@ -1,26 +1,101 @@
<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;
}
<main role="main">
<p class="auth-desc">
申请使用<strong class="app-name"> GitLink </strong>账号登录
<strong class="app-name"><%= @app&.name %></strong>
</p>
input {
line-height: normal;
}
</style>
<% if User.current.logged? %>
<main role="main">
<p class="auth-desc">
<strong class="app-name"><%= @app&.name %></strong>客户端<br/>
此第三方应用请求获得以下权限:
<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 %>
<%= hidden_field_tag :state, params[:state] %>
<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' %>
</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>
</div>
</main>
</main>
<% else %>
<main role="main">
<p class="auth-desc">
申请使用<strong class="app-name"> GitLink </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 %>