implement github oauth and display user's name and avatar from it
This commit is contained in:
49
lib/entendu_web/templates/page/index.html.eex
Normal file
49
lib/entendu_web/templates/page/index.html.eex
Normal file
@@ -0,0 +1,49 @@
|
||||
<section class="phx-hero">
|
||||
<h1>Überauth + Phoenix Example</h1>
|
||||
<p>
|
||||
This is an application to show an example of how to wire up
|
||||
<a href="https://github.com/ueberauth/ueberauth">Überauth</a> with
|
||||
<a href="https://github.com/phoenixframework/phoenix">Phoenix</a>.
|
||||
</p>
|
||||
<%= if @current_user do %>
|
||||
<h2>Welcome, <%= @current_user.name %>!</h2>
|
||||
<div>
|
||||
<img src="<%= @current_user.avatar %>" />
|
||||
</div>
|
||||
<%= link "Logout", to: Routes.auth_path(@conn, :delete), method: "delete", class: "button" %>
|
||||
<br>
|
||||
<% else %>
|
||||
<ul style="list-style: none">
|
||||
<li>
|
||||
<a class="button" href="<%= Routes.auth_path(@conn, :request, "github") %>">
|
||||
<i class="fa fa-github"></i>
|
||||
Sign in with GitHub
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" href="<%= Routes.auth_path(@conn, :request, "facebook") %>">
|
||||
<i class="fa fa-facebook"></i>
|
||||
Sign in with Facebook
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" href="<%= Routes.auth_path(@conn, :request, "google") %>">
|
||||
<i class="fa fa-google"></i>
|
||||
Sign in with Google
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" href="<%= Routes.auth_path(@conn, :request, "slack") %>">
|
||||
<i class="fa fa-slack"></i>
|
||||
Sign in with Slack
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" href="<%= Routes.auth_path(@conn, :request, "twitter") %>">
|
||||
<i class="fa fa-twitter"></i>
|
||||
Sign in with Twitter
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</section>
|
Reference in New Issue
Block a user